|
MTek-GDL 0.100.4-muffintrap
|
MenuCreator class for simple Immediate Mode Gui. More...
Go to the source code of this file.
Data Structures | |
| struct | Menu |
| Struct for holding the state of immeadiate mode gui menu. More... | |
Typedefs | |
| typedef struct Menu | Menu |
Functions | |
| void | Menu_DrawCursor (void) |
| Draws a cursor using the Default font and default values. | |
| void | _Menu_DrawCursorParams (short x, short y, short w, short h, Color4f *color) |
| void | Menu_SetActive (Menu *menu) |
| Set the menu to which the other functions are applied to. | |
| void | Menu_ReadDefaultInputs (void) |
| reads the default cursor and mouse status into the gui system | |
| Menu * | Menu_Create (Font *font, float textHeigh, float rowHeightEm) |
| Creates a MenuCreator using font and parameters. | |
| Menu * | Menu_CreateWindowed (Font *font, float textHeight, float rowHeightEm, short width, short height, const char *title) |
| Creates a windowed menu. | |
| Menu * | Menu_CreateDefault (void) |
| Creates a MenuCreator using default font and settings. | |
| void | Menu_StartInput (short x, short y, short width, vec2 cursorPosition, bool buttonPress, bool buttonHeld) |
| Starts the menu from given position and takes the input status. | |
| void | Menu_Start (short x, short y, short width) |
| Starts the menu from given position and uses default inputs. | |
| void | Menu_SetColors (Color4f *bg, Color4f *text, Color4f *highlight) |
| Sets the colors used in the menu. | |
| void | _Menu_TitleBar (void) |
| Draws the window title bar. | |
| void | _Menu_Borders (void) |
| Draws the window borders. | |
| void | Menu_Separator (void) |
| Draws a line separating elements. | |
| void | Menu_Skip (short height) |
| Leaves empty space for custom elements. | |
| void | Menu_Text (const char *text) |
| Draws text. | |
| void | Menu_TextF (const char *format,...) |
| Draws formatted text. | |
| void | Menu_Icon (IconSymbol icon, Color4f *color) |
| Draws a colored icon. | |
| bool | Menu_Button (const char *text) |
| Draws a button that can be clicked. | |
| bool | Menu_Toggle (const char *text, bool *valueRef) |
| Draws a toggle that can be clicked. | |
| void | Menu_Flag (const char *text, bool enabled) |
| Draws a text label with can be highlighted. | |
| bool | Menu_Slider (const char *text, float minValue, float maxValue, float *valueRef) |
| Draws a slider that can be adjusted with mouse or by pressing buttons. | |
MenuCreator class for simple Immediate Mode Gui.
This can be used to create simple menus with buttons and labels. Not much else yet. Added for version 0.100.0-muffintrap
| bool Menu_Button | ( | const char * | text | ) |
Draws a button that can be clicked.
| text | Text on the button. |
Creates a MenuCreator using font and parameters.
| font | Font to use on the menu elements. |
| textHeight | Height of the text. |
| rowHeightEm | Height of the row relative to the text height. 1 Em is same as text height, 2 is twice etc. Controls the amount of padding above and below text on elements. |
| Menu * Menu_CreateDefault | ( | void | ) |
Creates a MenuCreator using default font and settings.
| Menu * Menu_CreateWindowed | ( | Font * | font, |
| float | textHeight, | ||
| float | rowHeightEm, | ||
| short | width, | ||
| short | height, | ||
| const char * | title | ||
| ) |
Creates a windowed menu.
| font | Font to use on the menu elements. |
| textHeight | Height of the text. |
| rowHeightEm | Height of the row relative to the text height. 1 Em is same as text height, 2 is twice etc. Controls the amount of padding above and below text on elements. |
| width | Width of the window in pixels. -1 means automatic |
| height | Height of the window in pixels. -1 means automatic |
| text | Title of the window. |
| void Menu_Flag | ( | const char * | text, |
| bool | enabled | ||
| ) |
Draws a text label with can be highlighted.
| text | Text on the label. |
| enabled | When true, the label uses highlight color |
| void Menu_Icon | ( | IconSymbol | icon, |
| Color4f * | color | ||
| ) |
Draws a colored icon.
| icon | The icon to draw |
| void Menu_SetActive | ( | Menu * | menu | ) |
Set the menu to which the other functions are applied to.
Only one menu is drawn at one time, so using this function saves typing.
Sets the colors used in the menu.
| bg | Background color of labels and buttons. |
| text | Color of the text. |
| highlight | Highlight color to show hovered element. |
| void Menu_Skip | ( | short | height | ) |
Leaves empty space for custom elements.
| height | How much to move the position of next item downwards |
| bool Menu_Slider | ( | const char * | text, |
| float | minValue, | ||
| float | maxValue, | ||
| float * | valueRef | ||
| ) |
Draws a slider that can be adjusted with mouse or by pressing buttons.
| text | Text on the slider. |
| minValue | The minimum value of the slider. |
| maxValue | The maximum value of the slider. |
| valueRef | Reference to the float value controlled by the slider. |
| void Menu_Start | ( | short | x, |
| short | y, | ||
| short | width | ||
| ) |
Starts the menu from given position and uses default inputs.
This function sets up the menu state but does not draw anything yet. It uses the input status that was read when Menu_ReadDefaultInputs was last called. If the menu is windowed, the x and y only set the starting position
| x | Upper left corner x of the first element. |
| y | Upper left corner y of the first element. |
| width | Width of the elements in the menu. |
| void Menu_StartInput | ( | short | x, |
| short | y, | ||
| short | width, | ||
| vec2 | cursorPosition, | ||
| bool | buttonPress, | ||
| bool | buttonHeld | ||
| ) |
Starts the menu from given position and takes the input status.
This function sets up the menu state but does not draw anything yet. It requires the cursor position and button state.
| x | Upper left corner x of the first element. |
| y | Upper left corner y of the first element. |
| width | Width of the elements in the menu. |
| cursorX | cursorPosition Position of the cursor on the screen in pixels. |
| buttonPress | Is the button pressed on this frame. |
| void Menu_Text | ( | const char * | text | ) |
Draws text.
| text | Text to be drawn. |
| void Menu_TextF | ( | const char * | format, |
| ... | |||
| ) |
Draws formatted text.
| text | Format string. |
| __VA_ARGS__ | Format parameters. |
| bool Menu_Toggle | ( | const char * | text, |
| bool * | valueRef | ||
| ) |
Draws a toggle that can be clicked.
| text | Text on the toggle. |
| valueRef | Pointer to the boolean controller by the toggle. |