Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [nuklear-doc] About Windows

Author
Message
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 10th Oct 2020 06:40 Edited at: 13th Oct 2020 07:25
About Windows


This is a part of the nuclear plugin documentation.

Some of the marked functions are available in a shortened form in AGK-Basic version. In general, this concerns those functions where the parameters could also be passed as nk_vec2 or nk_rect.
Others of these marked functions return only a Memblock-ID. This is then converted with the corresponding AppGameKit function in a UDT.

Function overview (Plugin - .DLL/.SO)
  • Integer WindowBegin(title as String, posx as Float, posy as Float, width as Float, height as Float, flags as Integer)
  • Integer WindowBegIntegeritled(name as String, title as String, posx as Float, posy as Float, width as Float, height as Float, flags as Integer)
  • WindowEnd()
  • WindowStore(slot as Integer, name as String)
  • Integer WindowGetPosition()
  • Integer WindowGetSize()
  • Float WindowGetWidth()
  • Float WindowGetHeight()
  • Integer WindowGetContentRegion()
  • Integer WindowGetContentRegionMin()
  • Integer WindowGetContentRegionMax()
  • Integer WindowGetContentRegionSize()
  • WindowStoreCanvas(slot as Integer)
  • Integer WindowGetScroll()
  • Integer WindowHasFocus()
  • Integer WindowIsCollapsed(name as String)
  • Integer WindowIsClosed(name as String)
  • Integer WindowIsHidden(name as String)
  • Integer WindowIsActive(name as String)
  • Integer WindowIsHovered()
  • Integer WindowIsAnyHovered()
  • Integer WindowIsAnyActive()
  • WindowStorePanel(slot as Integer)
  • Integer WindowGetPanel()
  • Integer WindowGetPanelBounds()
  • Integer WindowGetBounds()
  • Float WindowGetBoundX()
  • Float WindowGetBoundY()
  • Float WindowGetBoundWidth()
  • Float WindowGetBoundHeight()
  • Float WindowGetContentRegionX()
  • Float WindowGetContentRegionY()
  • Float WindowGetContentRegionWidth()
  • Float WindowGetContentRegionHeight()
  • WindowSetBounds(name as String, x as Float, y as Float, w as Float, h as Float)
  • WindowSetPosition(name as String, x as Float, y as Float)
  • WindowSetSize(name as String, x as Float, y as Float)
  • WindowSetFocus(name as String)
  • WindowSetScroll(x as Integer, y as Integer)
  • WindowClose(name as String)
  • WindowCollapse(name as String , state as Integer)
  • WindowCollapseIf(name as String , state as Integer, cond as Integer)
  • WindowShow(name as String , state as Integer)
  • WindowShowIf(name as String , Integer state as , cond as Integer)


Parameter (Plugin)
  • name
    Gives a name to a window. Used to identify different windows. Also outside a WindowBegin() and WindowEnd() command.

  • title
    This is the title to be displayed. If the title stands alone without the parameter name, then the title is also the name.

  • posx, posy
    Position of a Windows.

  • width, height
    Size of a Windows.

  • flags
    Flags for a window. Affects the look, behavior and functionality of a window.

  • slot
    Is used as a workaround for the use of pointers. Some functions like the Draw/Stroke commands require such a 'slot' to access the pointer internally.

  • scrollx, scrolly
    Specifies the scroll offset.

  • state
    Describes a status - On or Off (1 or 0 / nk_true or nk_false).

  • cond
    Condition that must be complied with in order to actually perform the state change.

flags
NK_WINDOW_BORDER
NK_WINDOW_MOVABLE
NK_WINDOW_SCALABLE
NK_WINDOW_CLOSABLE
NK_WINDOW_MINIMIZABLE
NK_WINDOW_NO_SCROLLBAR
NK_WINDOW_TITLE
NK_WINDOW_SCROLL_AUTO_HIDE
NK_WINDOW_BACKGROUND
NK_WINDOW_SCALE_LEFT
NK_WINDOW_NO_INPUT
NK_WINDOW_PRIVATE
NK_WINDOW_DYNAMIC
NK_WINDOW_ROM
NK_WINDOW_NOT_INTERACTIVE
NK_WINDOW_HIDDEN
NK_WINDOW_CLOSED
NK_WINDOW_MINIMIZED
NK_WINDOW_REMOVE_ROM



Function overview (AGK-Basic - .AGC)
  • nk_rect nkWindowGetBounds()
  • nk_vec2 nkWindowGetSize()
  • nk_vec2 nkWindowGetPosition()
  • nk_rect nkWindowGetContentRegion()
  • nk_vec2 nkWindowGetContentRegionMin()
  • nk_vec2 nkWindowGetContentRegionMax()
  • nk_vec2 nkWindowGetContentRegionSize()
  • nk_rect nkWindowGetPanelBounds()
  • nk_vec2 nkWindowGetScroll()
  • nkWindowSetBounds(name as string as , bounds as nk_rect)
  • nkWindowSetPosition(name as string as , position as nk_vec2)
  • nkWindowSetSize(name as string as , size as nk_vec2)
  • nkWindowSetScroll(name as string as , scroll as nk_vec2)


Parameter (AGK-Basic)
  • name
    Gives a name to a window. Used to identify different windows. Also outside a WindowBegin() and WindowEnd() command.

  • bounds
    Position and size of a window

  • position
    Position of a window

  • size
    Size of a window

  • scroll
    Specifies the scroll offset.


A description of the most important functions can be found here on the nuclear page. I think you can match the corresponding functions.


There are three functions which are not described because they were created by me as work around.
This concerns the functions:
WindowStore(slot as Integer, name as String)
WindowStoreCanvas(slot as Integer)
WindowStorePanel(slot as Integer)


These functions simply store the pointers from the window, panel or canvas in an array. Other functions can then access this pointer.
WindowStore and WindowStorePanel are probably not necessary. I leave them in case there is a later use for them.
WindowStoreCanvas was used in the extended demo. This was necessary to write directly into the command buffer. For example if you want to write circles and lines directly into the command buffer.
The functions FillCircle, StrokeLine, DrawImage ect. finally use this pointer/slot.

Table of contents————Next topic (About Layout & Groups)


And now again a small example.



Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 10th Oct 2020 18:16
Thank you MadBit, really good work with this plugin and the documentation. BTW, do you have documentation for the FileExplorere plugin also somewhere on the forum?
????????
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Oct 2020 07:40
Thank you.
Unfortunately not only what is in the main thread.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 16th Oct 2020 16:43 Edited at: 16th Oct 2020 16:45
Hi MadBit,
Could you please suggest me a way to detect a release event of the left button of the mouse over a button?
Please take a look at the following function:

I need to set the 'buttonMain' variable on the release of the left button
gosukiwi
AGK Tool Maker
3
Years of Service
User Offline
Joined: 24th May 2020
Location: Argentina
Posted: 16th Oct 2020 16:52 Edited at: 16th Oct 2020 17:00
This is awesome Madbit, thanks for all the hard work! Would you consider putting the code up in GitHub together with the documentation in a single README.md file? You could also move it to a Wiki in your repo, to keep everything in the same place It would make things easier than scrapping the forums
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 16th Oct 2020 19:46 Edited at: 16th Oct 2020 19:56
@george++
There is no easy way to do this.
May I ask why it is so important that the buttons should react when the button is released?

The get the mouse button looks like this.
nk.InputIsMouseReleased(NK_BUTTON_LEFT)

To get the area of a button looks like this.
rect as nk_rect
rect = nkWidget()


@gosukiwi
Thank you.
I am not yet familiar with Github and would have to learn the possibilities and the handling of Github. Therefore I try to get everything ready first. I don't exclude to publish this later at Github.


EDIT:
@george++
You can also do it like this.

Main loop:

define 'result' outside your main loop.

your function:
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 17th Oct 2020 14:02
Quote: "May I ask why it is so important that the buttons should react when the button is released?"

It is not important. I just try to achieve some goals in order to get myself familiar with the library.
Any way thank you for the tip

Quote: "It would make things easier than scrapping the forums"

You are right. I use the Edge and created a collection for quick jumping from one thread to another. I suggest to MadBit create a thread dedicated to Nuklear questions and user feedbacks.

Login to post a reply

Server time is: 2024-04-19 05:58:11
Your offset time is: 2024-04-19 05:58:11