-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHouse.cpp
68 lines (60 loc) · 1.16 KB
/
House.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "house.h"
#include "core.h"
void House::changeDesign()
{
m_house_label = rand() % 7;
if (m_house_label == 0)
{
m_house = Texture{ U"🏠"_emoji };
}
else if (m_house_label == 1)
{
m_house = Texture{ U"🏘"_emoji };
}
else if (m_house_label == 2)
{
m_house = Texture{ U"🏡"_emoji };
}
else if (m_house_label == 3)
{
m_house = Texture{ U"🏚️"_emoji };
}
else if (m_house_label == 4)
{
m_house = Texture{ U"🛖"_emoji };
}
else if (m_house_label == 5)
{
m_house = Texture{ U"⛺️"_emoji };
}
else if (m_house_label == 6)
{
m_house = Texture{ U"⛪"_emoji };
}
}
void House::setPos(const double x, const double y)
{
m_x = x;
m_y = y;
}
bool House::isClicked(const bool canClick)
{
if (canClick)
{
if (SimpleGUI::Button(U"house", Vec2{ m_x - 50, m_y }, 100))
{
return true;
}
if (SimpleGUI::Button(U"house", Vec2{ m_x - 50, m_y + 20 }, 100))
{
return true;
}
if (SimpleGUI::Button(U"house", Vec2{ m_x - 50, m_y - 20 }, 100))
{
return true;
}
RectF{ m_x - 60, m_y - 30, HOUSE_SIZE, HOUSE_SIZE }.draw(ColorF{ SKY_BLUE });
}
m_house.resized(HOUSE_SIZE).drawAt(Vec2{ m_x, m_y });
return false;
}