-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHOTS.cpp
80 lines (68 loc) · 2.24 KB
/
HOTS.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) 2014 Nicolas Belouin <email>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "IHM/PolycodeGUI/IHM.h"
#include "GameEngine/GameEngine.h"
#include "utils/CreateDeck.h"
#include <Polycode.h>
#include <string>
#include <iostream>
#include "PolycodeView.h"
void printHelp();
int main (int argc, char** argv){
std::list<iCard*> *firstDeck = newDeck();
std::list<iCard*> *secondDeck = newDeck();
Hero* p0=newHero("Player 0");
Hero* p1=newHero("Player 1");
int c;
std::string address = "127.0.0.1";
bool single=false;
bool server=false;
if(argc >= 2){
if(std::string(argv[1])=="-c"){
if(argc == 2){
printHelp();
return 1;
}
address = argv[2];
} else if (std::string(argv[1])=="--single") {
single=true;
server=true;
} else if (std::string(argv[1])=="--server") {
server=true;
} else {
printHelp();
return 1;
}
}
else {
printHelp();
return 1;
}
if(server)
Engine::GameEngine *ge= new Engine::GameEngine((firstDeck),(secondDeck), p0,p1);
PolycodeView *view = new PolycodeView("Hello Polycode!");
IHM::PolycodeGUI::IHM *app = new IHM::PolycodeGUI::IHM(view, address, 1337);
while(app->Update()) {}
}
void printHelp() {
std::cout << "Usage : HOTS --single | --server | -c <serverAddress>" << std::endl;
std::cout << " --single : Play a single player game against an AI" << std::endl;
std::cout << " --server : Play a two players game as the host" << std::endl;
std::cout << " -c <serverAddress> : Play a two player game as a client to the given server" << std::endl;
}