-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIObject.cpp
More file actions
56 lines (43 loc) · 1.18 KB
/
UIObject.cpp
File metadata and controls
56 lines (43 loc) · 1.18 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "UIObject.hpp"
UIObject::UIObject() : active(false)
{
}
UIObject::UIObject(const sf::Vector2f& position, const sf::Vector2f& size) :
position(position), size(size), active(false)
{
}
/////////////////////////////////////////////////////////////////////////////////////////////
// CONTAINS
bool UIObject::contains(const sf::Vector2f& point) const
{
return point.x >= position.x && point.x < (position.x + size.x) &&
point.y >= position.y && point.y < (position.y + size.y);
}
/////////////////////////////////////////////////////////////////////////////////////////////
// SET && GET
void UIObject::setPosition(const sf::Vector2f& position)
{
this->position = position;
}
void UIObject::setSize(const sf::Vector2f& size)
{
this->size = size;
}
sf::Vector2f UIObject::getPosition()
{
return position;
}
sf::Vector2f UIObject::getSize()
{
return size;
}
/////////////////////////////////////////////////////////////////////////////////////////////
bool UIObject::isActive() const
{
return active;
}
void UIObject::setActive(bool value)
{
active = value;
}
/////////////////////////////////////////////////////////////////////////////////////////////