-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMULTIPLAYER.pde
More file actions
68 lines (54 loc) · 1.67 KB
/
MULTIPLAYER.pde
File metadata and controls
68 lines (54 loc) · 1.67 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
/* ----------------------------------------------------------- *\
SERVER
\* ----------------------------------------------------------- */
void createServer() {
svr = new Server(this, 28597);
if (svr.active()) {
SVR_running = true;
SVR_InError = !SVR_running;
println("server succesfully created");
} else {
SVR_running = false;
SVR_InError = !SVR_running;
println("Server couldn't be created");
}
}
/* ----------------------------------------------------------- *\
CLIENT
\* ----------------------------------------------------------- */
void createClient() {
cln = new Client(this, "127.0.0.1", 28597);
if (cln.active()) {
CLN_running = true;
CLN_InError = !CLN_running;
println("client succesfully created");
} else {
CLN_running = false;
CLN_InError = !CLN_running;
println("client couldn't be created");
}
}
/* ----------------------------------------------------------- *\
JSON OBJECTS
\* ----------------------------------------------------------- */
void connect() {
}
void checkServerInfo() {
}
void getServerInfo() {
}
/* ----------------------------------------------------------- *\
CLIENT EVENT
\* ----------------------------------------------------------- */
void clientEvent(Client someClient) {
println(someClient);
CLN_id = cln.read();
}
/* ----------------------------------------------------------- *\
SERVER EVENT
\* ----------------------------------------------------------- */
void serverEvent(Server server, Client client) {
clients.add(client);
println(clients);
println("Server: "+server.ip()+", Client: "+client.ip());
}