MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-gui.h
Go to the documentation of this file.
1#pragma once
2
3#include "mgdl-types.h"
4#include "mgdl-font.h"
5#include "mgdl-color.h"
6
18struct Menu
19{
20 float _drawx;
21 float _drawy;
22 float _menuWidth;
23 float _textHeight;
24 float _rowHeightEm;
25 float _textSize;
26
27 // Input state
28 bool _buttonPress;
29 bool _buttonHeld;
30 vec2 _cursorPosition;
31
32 // Colors
37 // Window
38 bool _drawWindow;
39 const char* _windowName;
40 float _windowx;
41 float _windowy;
42 float _windowHeight;
43 //float _windowWidth;
44
45 Font* _font;
46};
47typedef struct Menu Menu;
48
49#ifdef __cplusplus
50extern "C"
51{
52#endif
56 void Menu_DrawCursor(void);
57
58 void _Menu_DrawCursorParams(short x, short y, short w, short h, Color4f* color);
59
64 void Menu_SetActive(Menu* menu);
65
69 void Menu_ReadDefaultInputs(void);
70
78 Menu* Menu_Create(Font* font, float textHeigh, float rowHeightEm);
79
90 Menu* Menu_CreateWindowed(Font* font, float textHeight, float rowHeightEm, short width, short height, const char* title);
91
97
109 void Menu_StartInput(short x, short y, short width, vec2 cursorPosition, bool buttonPress, bool buttonHeld);
110
121 void Menu_Start(short x, short y, short width);
122
129 void Menu_SetColors(Color4f* bg, Color4f* text, Color4f* highlight);
130
134 void _Menu_TitleBar(void);
135
139 void _Menu_Borders(void);
140
144 void Menu_Separator(void);
145
150 void Menu_Skip(short height);
155 void Menu_Text(const char* text);
156
162 void Menu_TextF(const char* format, ...);
163
168 void Menu_Icon(IconSymbol icon, Color4f* color);
169
175 bool Menu_Button(const char* text);
182 bool Menu_Toggle(const char* text, bool* valueRef);
183
189 void Menu_Flag(const char* text, bool enabled);
190
199 bool Menu_Slider(const char* text, float minValue, float maxValue, float* valueRef);
200
201#ifdef __cplusplus
202}
203#endif
Color struct and functions.
Class for loading fonts and drawing text with them.
void Menu_TextF(const char *format,...)
Draws formatted text.
Definition mgdl-gui.cpp:155
void Menu_Flag(const char *text, bool enabled)
Draws a text label with can be highlighted.
Definition mgdl-gui.cpp:268
void Menu_SetColors(Color4f *bg, Color4f *text, Color4f *highlight)
Sets the colors used in the menu.
Definition mgdl-gui.cpp:135
void Menu_Text(const char *text)
Draws text.
Definition mgdl-gui.cpp:161
bool Menu_Button(const char *text)
Draws a button that can be clicked.
Definition mgdl-gui.cpp:183
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.
void _Menu_TitleBar(void)
Draws the window title bar.
Definition mgdl-gui.cpp:106
void _Menu_Borders(void)
Draws the window borders.
Definition mgdl-gui.cpp:121
Menu * Menu_CreateWindowed(Font *font, float textHeight, float rowHeightEm, short width, short height, const char *title)
Creates a windowed menu.
Definition mgdl-gui.cpp:57
void Menu_ReadDefaultInputs(void)
reads the default cursor and mouse status into the gui system
Definition mgdl-gui.cpp:17
void Menu_DrawCursor(void)
Draws a cursor using the Default font and default values.
Definition mgdl-gui.cpp:300
Menu * Menu_Create(Font *font, float textHeigh, float rowHeightEm)
Creates a MenuCreator using font and parameters.
Definition mgdl-gui.cpp:35
bool Menu_Toggle(const char *text, bool *valueRef)
Draws a toggle that can be clicked.
Definition mgdl-gui.cpp:216
void Menu_Start(short x, short y, short width)
Starts the menu from given position and uses default inputs.
Definition mgdl-gui.cpp:72
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.
Definition mgdl-gui.cpp:77
void Menu_SetActive(Menu *menu)
Set the menu to which the other functions are applied to.
Definition mgdl-gui.cpp:25
void Menu_Separator(void)
Draws a line separating elements.
Definition mgdl-gui.cpp:290
Menu * Menu_CreateDefault(void)
Creates a MenuCreator using default font and settings.
Definition mgdl-gui.cpp:30
void Menu_Skip(short height)
Leaves empty space for custom elements.
Definition mgdl-gui.cpp:295
void Menu_Icon(IconSymbol icon, Color4f *color)
Draws a colored icon.
Definition mgdl-gui.cpp:172
Library types, macros, defines and enums header.
Definition mgdl-color.h:54
Represents a font that can be used to draw text.
Definition mgdl-font.h:16
Struct for holding the state of immeadiate mode gui menu.
Definition mgdl-gui.h:19
Color4f _bg
Definition mgdl-gui.h:33
Color4f _highlight
Definition mgdl-gui.h:35
Color4f _text
Definition mgdl-gui.h:34