-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestClient2d.cpp
66 lines (52 loc) · 1.65 KB
/
testClient2d.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
#define ENABLE_LOGGING 1
#include "myutils.hpp"
#include "d_tcpclient.hpp"
int main() {
TcpClient tcpClient;
tcpClient.run();
int i = 0;
Obj obj;
obj.type = "fieldSize";
obj.props["w"] = 200u;
obj.props["h"] = 200u;
tcpClient.sendObj(obj);
while(true)
{
Obj obj = tcpClient.inMsgs.pop();
if (obj.type.empty())
break;
LOG("O " << obj);
{
Obj obj;
obj.type = "tick";
obj.props["num"] = 123u + i;
tcpClient.sendObj(obj);
obj.type = "someObj";
obj.props["i"] = 234u;
obj.subObjs["subObj1"]["type"] = "circumference";
obj.subObjs["subObj1"]["p"] = P(50 + i, 50 + i);
obj.subObjs["subObj1"]["r"] = 10.0;
obj.subObjs["subObj1"]["c"] = 0xff0000ffu;
obj.subObjs["subObj2"]["type"] = "line";
obj.subObjs["subObj2"]["p1"] = P(250 + i, 50);
obj.subObjs["subObj2"]["p2"] = P(150, 50);
obj.subObjs["subObj2"]["p3"] = P(80, 150);
obj.subObjs["subObj2"]["c"] = 0xffff00ffu;
obj.subObjs["subObj3"]["type"] = "poly";
obj.subObjs["subObj3"]["p1"] = P(150, 150);
obj.subObjs["subObj3"]["p2"] = P(150, 250);
obj.subObjs["subObj3"]["p3"] = P(80, 230);
obj.subObjs["subObj3"]["c"] = 0x00ff00ffu;
tcpClient.sendObj(obj);
LOG("WRITE TICK " << i);
++i;
}
{
Obj obj;
obj.type = "log";
obj.props["text"] = "Some text";
tcpClient.sendObj(obj);
}
}
return 0;
}