diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 17:58:53 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 17:58:53 +0100 |
commit | 5e833bba513d97c39f4e0d26b45a9095c32812a6 (patch) | |
tree | 57c2c6dfdb977a60425c4ca25d21e79fd5f02cf2 /mwe/events/include/uiObject.h | |
parent | f2136f836f9b9e9a6a6698f7bc6fba85a27ebebf (diff) |
button working
Diffstat (limited to 'mwe/events/include/uiObject.h')
-rw-r--r-- | mwe/events/include/uiObject.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mwe/events/include/uiObject.h b/mwe/events/include/uiObject.h index 46d32be..720d5c2 100644 --- a/mwe/events/include/uiObject.h +++ b/mwe/events/include/uiObject.h @@ -1,8 +1,10 @@ +#pragma once #include "gameObject.h" #include <SDL2/SDL.h> #include <SDL_ttf.h> #include "event.h" #include "eventHandler.h" +#include <functional> struct Alignment { enum class Horizontal { LEFT, CENTER, RIGHT }; enum class Vertical { TOP, MIDDLE, BOTTOM }; @@ -21,28 +23,29 @@ struct Alignment { int marginRight = 0; }; struct RGBColor{ - int red, - int green, - int blue + int red; + int green; + int blue; }; class UIObject : public GameObject{ public: UIObject(int width,int height); - private: + virtual ~UIObject() {} int width; int height; + int x; + int y; }; class Button : public UIObject{ public: Button(int width,int height); - EventHandler<KeyPressedEvent> onKeyPressed; - EventHandler<KeyReleasedEvent> onKeyReleased; + RGBColor color; + std::function<void()> onClick; }; class Text : public UIObject{ public: Text(int width,int height); - private: std::string text; int size; Alignment alignment; |