[ADD] added the menu buttons with correct textures to the scene
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user