-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.cpp
59 lines (53 loc) · 1.19 KB
/
View.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
#include <vector>
#include <Item.cpp>
#include "LCD_DISCO_F429ZI.h"
class View {
private:
std::vector<Item> ViewItems;
LCD_DISCO_F429ZI *lcd;
public:
View(LCD_DISCO_F429ZI lcd)
{
this->lcd = &lcd;
ViewItems.push_back(Item(0,0, lcd));
ViewItems.push_back(Item(0,50, lcd));
ViewItems.push_back(Item(0,100, lcd));
ViewItems.push_back(Item(0,150, lcd));
ViewItems.push_back(Item(50,0, lcd));
ViewItems.push_back(Item(50,50, lcd));
ViewItems.push_back(Item(50,100, lcd));
ViewItems.push_back(Item(50,150, lcd));
ViewItems.push_back(Item(100,0, lcd));
ViewItems.push_back(Item(100,50, lcd));
ViewItems.push_back(Item(100,100, lcd));
ViewItems.push_back(Item(100,150, lcd));
ViewItems.push_back(Item(150,0, lcd));
ViewItems.push_back(Item(150,50, lcd));
ViewItems.push_back(Item(150,100, lcd));
ViewItems.push_back(Item(150,150, lcd));
}
void Draw()
{
for (int j = 1; j < 50; j++)
{
for (int i = 0; i < ViewItems.size(); i++)
{
ViewItems[i].renderframe(j);
}
wait_ms(2);
}
}
void Touch(int X, int Y)
{
for (int i = 0; i < ViewItems.size(); i++)
{
if (ViewItems[i].Clickable(X, Y))
{
ViewItems[i].onClick();
}
}
}
~View()
{
}
};