-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
55 lines (46 loc) · 1.26 KB
/
main.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
#include <iostream>
#include "defines.h"
#include "graphics/graphlib.h"
#include "input/inputlib.h"
#include "playerlib.h"
#include "fpscontrol.h"
#include "mediator.h"
using namespace std;
std::string FILEPATH;
int main(int argc, char *argv[])
{
std::string EXEC_NAME;
#ifndef WIN32
EXEC_NAME = "rescueblaster";
#else
EXEC_NAME = "rescueblaster.exe";
#endif
std::string argvString = std::string(argv[0]);
FILEPATH = argvString.substr(0, argvString.size()-EXEC_NAME.size());
GameMediator::get_instance()->load();
graphlib glib;
inputlib ilib;
timerlib tlib;
playerlib player;
fpscontrol fps;
glib.init();
ilib.init();
tlib.start();
fps.initialize();
while (true) {
ilib.read();
player.setInput(ilib.getKeys());
if (ilib.getKey(INPUT_COMMAND_QUIT) == 1) {
break;
}
player.move();
glib.drawScreen();
glib.drawPlayer(player.get_x(), player.get_y(), player.getDirection(), player.getFly_accel(), player.getFly_speed());
glib.drawHud(player.getLives(), player.getBombs(), player.getPoints(), 100, 100-tlib.getCurrentTime());
glib.updateScreen();
fps.limit();
}
ilib.quit();
glib.quit();
return 0;
}