-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDebugGame.cpp
More file actions
79 lines (62 loc) · 1.63 KB
/
DebugGame.cpp
File metadata and controls
79 lines (62 loc) · 1.63 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
//
// DebugGame.cpp
// ServerXcode
//
// Created by James Lennon on 10/31/14.
// Copyright (c) 2014 James Lennon. All rights reserved.
//
#include "DebugGame.h"
using namespace openpad;
DebugGame::DebugGame(int maxPlayers){
numPlayers = 0;
this->maxPlayers = maxPlayers;
}
void DebugGame::onStart(){
printf("Game started\n");
}
bool DebugGame::canJoin(Client *cli){
if(cli->clientID->firstname == "Christian"){
return false;
}else{
return true;
}
}
string DebugGame::whyIsBanned(openpad::Client *cli){
if(cli->getID().firstname == "Christian"){
return "Get outta here Christian";
}
return "";
}
string DebugGame::getName(){
return "Debug Game";
}
string DebugGame::getDesc(){
return "Game program to debug openpad server";
}
string DebugGame::getIconFilePath(){
return "DebugSmall.png";
}
int DebugGame::getFilledSlots(){
return numPlayers;
}
int DebugGame::getOpenSlots(){
return maxPlayers-numPlayers;
}
void DebugGame::onJoin(Client *cli){
printf("Client joined: %s\n", cli->clientID->username.c_str());
}
PadConfig DebugGame::getDefaultControls(){
PadConfig conf;
ButtonControl *btn1 = new ButtonControl(.2, .2, .1, 0, BUTTON_A);
DPadControl *dpad = new DPadControl(.5, .75, .2, 1);
conf.addControl(btn1);
conf.addControl(dpad);
return conf;
}
void DebugGame::onDisconnect(Client *cli){
printf("%s disconnected\n", cli->clientID->username.c_str());
}
void DebugGame::onPadUpdate(Client *cli, PadUpdateObject update){
//Player controller action
printf("Player did something with control %d\n", update.controlid);
}