-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.cpp
More file actions
81 lines (56 loc) · 1.5 KB
/
Copy pathclient.cpp
File metadata and controls
81 lines (56 loc) · 1.5 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "raylib.h"
#include "Components/Textbox.hpp"
#include "Components/Component.hpp"
#include "Sections/Section.hpp"
#include "Sections/ClientSection.hpp"
#include "Sections/MsgSection.hpp"
#include "Sections/PlotSection.hpp"
#include "Client/Client.hpp"
#include "Manager/InputManager.hpp"
void getAllComponents();
ClientSection client;
PlotSection plot;
MsgSection msg;
map<int, Component*> allComponents;
InputManager* pInput = InputManager::getInstance();
int main(void)
{
cin.tie(0);
ios_base::sync_with_stdio();
bool isclient;
InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "DataCom");
client.init();
plot.init();
msg.init(&plot);
msg.setIsClient(true);
SetTargetFPS(60);
getAllComponents();
pInput->setMap(allComponents);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
client.update();
msg.update();
plot.update();
EndDrawing();
pInput->execute();
}
CloseWindow();
return 0;
}
void getAllComponents(){
int i = 0;
vector<Component*> c = client.getComponents();
vector<Component*> m = msg.getComponents();
vector<Component*> p = plot.getComponents();
for(int i = 0; i < c.size(); i++){
allComponents[c[i]->getId()] = c[i];
}
for(int i = 0; i < m.size(); i++){
allComponents[m[i]->getId()] = m[i];
}
for(int i = 0; i < p.size(); i++){
allComponents[p[i]->getId()] = p[i];
}
}