diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-04-13 07:41:31 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-04-13 07:41:31 -0400 |
commit | 51f57a9eb06cd0a4a967915ee60a323fc85fafba (patch) | |
tree | 3ac6459043382584ad4b35c78be4cb0717c8ddda /include/ui_menu.hpp | |
parent | a3f1f1bff9b58d90a2b60405ca40728cdd836fa6 (diff) | |
parent | 03130c5bcec3c885a1be005c24e192dfb57f3fe5 (diff) |
Merge branch 'master' of https://github.com/tcsullivan/gamedev
Diffstat (limited to 'include/ui_menu.hpp')
-rw-r--r-- | include/ui_menu.hpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/include/ui_menu.hpp b/include/ui_menu.hpp new file mode 100644 index 0000000..9a51739 --- /dev/null +++ b/include/ui_menu.hpp @@ -0,0 +1,63 @@ +#ifndef UI_MENU_H_ +#define UI_MENU_H_ + +#include <common.hpp> +#include <config.hpp> + +typedef void (*menuFunc)(void); + +struct menuItem { + int member; + union { + struct { + vec2 loc; + dim2 dim; + Color color; + + const char *text; + menuFunc func; + } button; + struct { + vec2 loc; + dim2 dim; + Color color; + + float minValue; + float maxValue; + float sliderLoc; + + const char *text; + float *var; + } slider; + }; +}; + +class Menu { +public: + std::vector<menuItem> items; + Menu *child, *parent; + + ~Menu() { + // TODO you CANNOT delete null pointers! + /*child = NULL; + parent = NULL; + delete child; + delete parent;*/ + } + + void gotoChild(void); + void gotoParent(void); +}; + +namespace ui { + namespace menu { + menuItem createButton(vec2 l, dim2 d, Color c, const char* t, menuFunc f); + menuItem createChildButton(vec2 l, dim2 d, Color c, const char* t); + menuItem createParentButton(vec2 l, dim2 d, Color c, const char* t); + menuItem createSlider(vec2 l, dim2 d, Color c, float min, float max, const char* t, float* v); + + void draw( void ); + } +} + +#endif // UI_MENU_H_ |