[ADD] added the menu buttons with correct textures to the scene

This commit is contained in:
Jasper
2021-06-01 15:10:23 +02:00
parent ef466c9d95
commit 7679555059
14 changed files with 88 additions and 3 deletions

View File

@@ -5,6 +5,11 @@
namespace gui
{
//Represents the type of the entitie
enum class GuiType{
LABEL, BUTTON
};
/*
* Structure for representing a gui item to display on the screen
*
@@ -12,12 +17,17 @@ namespace gui
* position = The center position of the gui
* scale = The size (scale) of the gui
*/
struct GuiTexture
{
int texture;
glm::vec2 position;
glm::vec2 scale;
virtual GuiType GetType() {
return GuiType::LABEL;
}
GuiTexture(int texture, glm::vec2 position, glm::vec2 scale): texture(texture), position(position), scale(scale)
{
scale.x /= (WINDOW_WIDTH / WINDOW_HEIGT);

View File

@@ -104,6 +104,10 @@ namespace gui
*/
void SetOnExitAction(void (*fun)()) { on_exit_action = fun; }
GuiType GetType() override {
return GuiType::BUTTON;
}
protected:
void OnClick() override { if (on_click_action != nullptr) on_click_action(); }
void OnEnter() override { if (on_enter_action != nullptr) on_enter_action(); }