-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextBox.cpp
43 lines (31 loc) · 866 Bytes
/
TextBox.cpp
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
29
30
31
32
33
34
35
36
37
38
39
40
//
// Created by Brandon Hargitay on 3/16/23.
//
#include "TextBox.h"
TextBox::TextBox(){
box.setOutlineColor(sf::Color::White);
box.setFillColor({55,55,55});
box.setOutlineThickness(2.f);
box.setSize({400.0f,50.0f});
label.setFont(Font::getFont());
label.setFillColor(sf::Color::White);
label.setCharacterSize(30);
label.setFillColor(sf::Color(255,255,255,75));
}
void TextBox::draw(sf::RenderTarget &target, sf::RenderStates states) const {
target.draw(box);
target.draw(label);
}
void TextBox::setPosition(float x, float y) {
box.setPosition(x,y);
label.setPosition(x,y);
}
sf::FloatRect TextBox::getGlobalBounds() const{
return box.getGlobalBounds();
}
void TextBox::centerText() {
Position::centerText(box,label);
}
void TextBox::setString(const std::string str) {
label.setString(str);
}