Home | Features | Roadmap | Learn | Documentation | ||
Latest version: Tramway SDK 0.0.9 Github Quick links Home Get Started |
GUIThe GUI system provides GUI widgets. Unlike inferior GUI systems, which use objects (Win32, etc.) or classes (Java Swing, etc.), this GUI system is immediate mode. Which means that instead of creating an object, you just call a function once per frame. Key conceptsWidgetGUI element, i.e. buttons, text boxes, checkmarks, radio buttons, etc. FrameFrames are used to position widgets. They are arranged in a stack. When you push a frame, all of the consequent widgets will be drawn inside that frame. After you are done with a frame, you need to pop it from the frame stack. Immediate mode
This basically means that you call function instead of creating objects to
manage GUI widgets. For example, the function for creating a button is
Pushing frames
Frames can be created using absolute coordinates, or pushed relative to the
underlying frame. For example, pushing frame 100 pixels from
This is how we push the frames. Very simple, very easy, very nice. FontsFonts are basically just sprites that have been registered For each character that is rendered, its character code in the encoding is used as an index to select a frame from the spritesheet. The fonts can be used to draw text. They are also used for widgets themselves. If you want to use some pre-made widget and text fonts, then you can use the Menu extension. It contains some fonts that you can use. WidgetsGlyphDraws a single glyph from the font spritesheet. TextDraws some text. ButtonDraws a clickable button. The button function returns true if it has been clicked. Radio buttonAllows selection between several exclusive choices. The choices are represented by an index. CheckboxAllows a boolean yes/no type of selection. SliderAllows selecting a floating point value by dragging a slider. TextboxAllows text input. Programming in C++
The GUI system needs the Render and the UI systems to be initialized before being initialized itself.
GUI::Init();
Pushing frames is easy, but you need to remember to pop them afterwards.
Here's how to use the various widgets.
Scripting in LuaNot yet implemented. |
|
|