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 Layouts and Groups

Author
Message
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 13th Oct 2020 07:01 Edited at: 15th Oct 2020 07:36
About Layout & Group


This time I show you an overview of the layouts and groups.
Layouts are used to place the widgets in your window, so you could say that every window that contains widgets MUST have a layout.
Also for this topic you can find a description of the commands on the original nuclear documentation page.
Like last time, some functions are marked here for the same reasons as in the window topic.

Function overview Layout (Plugin - .DLL/.SO)
  • LayoutSetMinRowHeight(height as Float)
  • LayoutResetMinRowHeight()
  • Integer LayoutWidgetBounds()
  • Float LayoutRatioFromPixel(pixel_width as Float)
  • LayoutRowStatic(height as Float, item_width as Integer, cols as Integer)
  • LayoutRowDynamic(height as Float, cols as Integer)
  • LayoutRowBegin(format as Integer, height as Float, cols as Integer)
  • LayoutRowEnd()
  • LayoutRow(format as Integer, height as Float, ratio_sz as String)
  • LayoutRowPush(width_ratio as Float)[/*]
  • LayoutRowTemplateBegin(height as Float)
  • LayoutRowTemplatePushDynamic()[/*]
  • LayoutRowTemplatePushVariable(min_width as Float)
  • LayoutRowTemplatePushStatic( width as Float)
  • LayoutRowTemplateEnd()
  • LayoutSpaceBegin(format as Integer, height as Float, count as Integer)
  • LayoutSpaceEnd()[/*]
  • Integer LayoutSpaceBounds()
  • LayoutSpacePush(posx as Float, posy as Float, width as Float, height as Float)
  • Integer LayoutSpaceToScreen(posx as Float, posy as Float)
  • Integer LayoutSpaceToLocal(posx as Float, posy as Float)
  • Integer LayoutSpaceRectToScreen(posx as Float, posy as Float, width as Float, height as Float)
  • Integer LayoutSpaceRectToLocal(posx as Float, posy as Float, width as Float, height as Float)


Function overview Group (Plugin - .DLL/.SO)
  • Integer GroupBegin(String title, Integer flags)
  • Integer GroupBeginTitled(String name, String title, Integer flags)
  • GroupEnd()


Parameter Layout (Plugin)
  • height
    Sets the height of the row.
  • pixel_width
    Pixel width to convert to window ratio.
  • item_width
    Holds the pixel width of each widget in the line.
  • cols
    Number of widgets in the row.
  • format
    Either NK_DYNAMIC for the window ratio or NK_STATIC for fixed size columns.
  • ratio_sz
    A JSON string containing float values to split the line into individual columns. The string has the following format "[#.##,#.##,...]".
  • width_ratio
    Either a window ratio or a fixed width depending on format in the previous LayoutRowBegin call
  • min_width
    Holds the minimum pixel width, for the next column.
  • width
    Contains the absolute pixel width value, for the next column.
  • count
    Number of widgets in the SpaceLayout.


Parameter Group (Plugin)
  • title
    Holds the title of the group widget.
  • flags
    These flags are the same as for WindowBegin. See there.
  • name
    This name is used to identify the group internally. The name should be unique. If the title stands alone without the parameter name, then the title is also the name.


Function overview (AGK-Basic - .AGC)
  • nk_rect nkLayoutSpaceBounds()
  • nk_rect nkLayoutSpaceRectToScreen(rect ref as nk_rect)
  • nkLayoutRow(format as integer, height as float, ratio ref as float[])
  • nk_rect nkLayoutWidgetBounds()[/*]
  • nkLayoutSpacePush(rect ref as nk_rect)
  • nk_vec2 nkLayoutSpaceToScreen(pos ref as nk_vec2)
  • nk_vec2 nkLayoutSpaceToLocal(pos ref as nk_vec2)
  • nk_rect nkLayoutSpaceRectToLocal(rect ref as nk_rect)


Parameter (AGK-Basic)
  • rect
    Contains the position and size of an area in an nk_rect UDT.
  • format
    Either NK_DYNAMIC for the window ratio or NK_STATIC for fixed size columns.
  • height
    Sets the height of the row.
  • ratio
    A float array containing the column widths, either as ratios between 0.0 and 1.0 or as absolute numbers greater than 1.0.
  • pos
    Contains a position in an nk_vec2 UDT


Previous topic (About Windows) ———— Table of contents ———— Next topic (About Menus)

Now an example for using layouts.



Here is another example for the use of space layouts.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Login to post a reply

Server time is: 2024-04-18 01:03:40
Your offset time is: 2024-04-18 01:03:40