New menu editing
the new UI is not provided by default, to access it, you will need to compile sandbox with -DNEWGUI
Windows Users
using codeblocks follow these steps after opening the project
- click on project
- click on build options
- click on defines
- type -DNEWGUI in the box that appears
Linux Users
users using codeblocks should follow the above steps, people using the Makefile follow these
- open the desired makefile in a text editor
- add -DNEWGUI into the CXXFLAGS string
- make clean && make install
OSX
???
Contents
How it works
It should be noted that even we are still trying to figure out how it works.
Forks
The forks basically represent how it can be interacted with. Generally there is an image when not selected and an additional two for each hovering and selected case. For each of these forks it is requires that a child image exists (an image is a class derived from Filler, such as those provided by uiimage and uicolor). For example, an element with 3 forks...
uibutton [echo "Hello World"] [ uiimage "data/hud/2.1/icons/action.jpg" .05 .05 uiimage "data/hud/2.2/icons/action.jpg" .05 .05 uiimage "data/hud/2.3/icons/action.png" .05 .05 ]
Siblings
When looking for a sibling item, the element in question first looks at its parent, and then it's parent (etc). Siblings elements are declared alongside the element, or as its parent. In this example, uiscroll and uiscrollbar are declared as siblings and uiscrollbutton is declared as a child of uiscrollbar.
uiscroll .94 1 [ ... ] uiscrollbar .06 1 [ .... uiscrollbutton [ ... ] ]
Children
When searching for a specific child element, the element searches its children and then its children. Simply, child elements are defined as part of its children. In the above example, uiscrollbutton is declared as a child of uiscrollbar.
States
- Idle - when your cursor is not hovering over the element, nor is it selected
- Hovering - when your cursor hovers over the element without clicking it
- Selected - when you click the element, you do not necessarily have to be hovering over it
Creating
When making menus or other miscellaneous UIs through this, you should place the showui command within an alias named showMYMENU, where MYMENU is substituted for the name of the menu. For example...
showMYMENU = [ showui MYMENU [ ... ] ]
Commands
hideui
- Arguments: Name
Hides the UI which matches the name
replaceui
- Arguments: Name Tag Children
within the named UI, it finds the tag which matches the provided name replaces its children
showui
- Arguments: Name Children On-Hide
Creates a UI named Name which contains the provided children. The On-Hide script (if provided) is executed when the UI is closed
uialign
- Arguments: X Y
both arguments can be one of -1, 0 or 1. -1 refers to the top left and 1 to the bottom right. For example, uialign 1 0 will align things to the right.
uiclamp
- Arguments: Left Right Bottom Top
???
Elements
NOTE: these names of the classes do not necessarily correspond to the names of the commands to call them. if you want information of a specific command, please use ctrl-F to find it
Button
- arguments: Action Children
- forks: 3
- fork1: default
- fork2: hovering
- fork3: selected
- siblings: None
- children: None
- provided by: uibutton
ColorText
- arguments: Text Size R G B Children
- forks: 0
- siblings: None
- children: None
- provided by: uicolortext
- See Also: Text
Image
- arguments: Image W-Size H-Size Children
- forks: 0
- siblings: None
- children: None
- provided by: uiimage
- See Also: StretchedImage CroppedImage BorderImage SlotViewer
List
- arguments: Space Children
- forks: 0
- siblings: None
- children: None
- provided by: uihlist uivlist
Space is the amount of padding between the contained elements.
Rectangle
- arguments: R G B (A) W-Size H-Size Children
- forks: 0
- siblings: None
- children: None
- provided by: uicolor uimodcolor
uimodcolor does not accept an alpha channel, and only takes 5 values and its children, instead of 6 values its children like uicolor. The difference between the two is that the first draws a solid rectangle, and the second draws one which modulates the colour of the UI.
ScrollBar
- arguments: Image W-Size H-Size Children
- forks: 5
- fork1: default
- fork2: hovering over up arrow
- fork3: selected up arrow
- fork4: hovering over down arrow
- fork5: selected down arrow
- siblings: Scroller
- children: ScrollButton
- provided by: uihscrollbar uivscrollbar
ScrollButton
- arguments: Children
- forks: 3
- fork1: default
- fork2: hovering
- fork3: selected
- siblings: None
- children: None
- provided by: uiscrollbutton
Scroller
- Arguments: W-Size H-Size Children
- Forks: 0
- Siblings: None
- Children: None
- Provided By: uiscroll
SlotViewer
- Arguments: Slot W-Size H-Size Children
- Forks: 0
- Siblings: None
- Children: None
- Provided By: uiviewslot
Spacer
- Arguments: X-padding Y-Padding Children
- Forks: 0
- Siblings: None
- Children: None
- Provided By: uispace
uispace places the padding around its children, so the space consumed is essentially twice as much as you tell it to. This is useful for getting the elements away from the edges.
StretchedImage
- Arguments: Image W-Size H-Size Children
- Forks: 0
- Siblings: None
- Children: None
- Provided By: uistretchedimage
Tag
- arguments: Name Children
- forks: 0
- siblings: None
- children: None
- provided by: uitag
replaceui can be used to replace the contents of a tag
Text
- arguments: Text Size Children
- forks: 0
- siblings: None
- children: None
- provided by: uitext
- See Also: ColorText
Toggle
- Arguments: Condition On-Select Split Children
- Forks: 4
- fork1: ???
- fork2: ???
- fork3: ???
- fork4: ???
- Siblings: None
- Children: None
- Provided By: uitoggle