C++ Project 2016-2017: Arkanoid
src
main.cpp
Go to the documentation of this file.
1
3
#include "
arkanoid/arkanoid.h
"
4
5
#include <iostream>
6
#include <string>
7
62
int
main(
int
argc,
char
* argv[]) {
63
64
try
{
65
66
Arkanoid
arkanoid
;
67
68
// Start from level_1
69
if
(argc == 1) {
70
arkanoid.
run
();
71
72
// Jump to a level
73
}
else
if
(argc == 2) {
74
try
{
75
string
arg = string(argv[1]);
76
if
(arg.substr(0, 3) ==
"-l="
) {
77
int
level;
78
try
{
79
level = stoi(arg.substr(3, arg.size()-3));
80
}
catch
(...) {
81
throw
runtime_error(
"Second argument should be \"-l=<level>\" (with <level> a number)"
);
82
}
83
arkanoid.
run
(level);
84
}
else
{
85
throw
runtime_error(
"Second argument should be \"-l=<level>\" (with <level> an int)"
);
86
}
87
}
catch
(...) {
88
throw
;
89
}
90
91
}
else
{
92
throw
runtime_error(
"Unvalid arguments"
);
93
}
94
95
}
catch
(exception &e) {
96
cout <<
"ERROR: "
<< e.what() << endl;
97
}
98
99
return
0;
100
}
Arkanoid::run
void run(int level=1)
Definition:
arkanoid.cpp:59
arkanoid.h
Arkanoid
The actual game that can be run. Interacts with the arkanoid and the arkanoidSFML.
Definition:
arkanoid.h:18
arkanoid
All the game logic of the Arkanoid game.
Definition:
ball.cpp:15
Generated by
1.8.13