diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 11:06:21 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 11:06:21 +0100 |
commit | 29f9a26046e35c7eb0157df92757ce8e39f1ec74 (patch) | |
tree | 18be4912561c2fcc9a57b99466c74977e11f2abf /mwe/events/src/uiObject.cpp | |
parent | f1b2c5a38f49bb319babf11bf64c420a63e104f2 (diff) |
iMouseListener and iKeyListener implementation
Diffstat (limited to 'mwe/events/src/uiObject.cpp')
-rw-r--r-- | mwe/events/src/uiObject.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mwe/events/src/uiObject.cpp b/mwe/events/src/uiObject.cpp new file mode 100644 index 0000000..b941858 --- /dev/null +++ b/mwe/events/src/uiObject.cpp @@ -0,0 +1,28 @@ +#include "uiObject.h" + +// Constructor for UIObject +UIObject::UIObject(int width, int height) + : width(width), height(height) { + + } + +// Constructor for Button +Button::Button(int width, int height) + : UIObject(width, height) { +} + +Text::Text(int width, int height) + : UIObject(width, height), size(12), font(nullptr), color{255, 255, 255} { // Default size and color + alignment.horizontal = Alignment::Horizontal::CENTER; + alignment.vertical = Alignment::Vertical::MIDDLE; + alignment.mode = Alignment::PositioningMode::RELATIVE; +} + +TextInput::TextInput(int width, int height) + : UIObject(width, height), textBuffer(""), placeholder(""), caretPosition(0), + isActive(false), textColor{255, 255, 255}, backgroundColor{0, 0, 0}, maxLength(100), font(nullptr) { + alignment.horizontal = Alignment::Horizontal::LEFT; + alignment.vertical = Alignment::Vertical::TOP; + alignment.mode = Alignment::PositioningMode::RELATIVE; +} + |