aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/src/uiObject.cpp
blob: b94185812211c13ef579762678dd15f89a6b0a8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}