-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cpp
70 lines (59 loc) · 1.47 KB
/
Game.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
/**
* @author: Kevin J. Estevez (kenystev)
*
* GNU GENERAL PUBLIC LICENSE Version 2
* The licenses for most software are designed to take away your
* freedom to share and change it. By contrast, the GNU General Public
* License is intended to guarantee your freedom to share and change free
* software--to make sure the software is free for all its users. This
* General Public License applies to most of the Free Software
* Foundation's software and to any other program whose authors commit to
* using it.
*/
#include "Game.h"
#include "Rosalila/RosalilaGraphics/RosalilaGraphics.h"
Game::Game()
{
screen=NULL;
//Input receiver initialization
receiver = new Receiver();
//Graphics initialization
rosalila_graphics = new RosalilaGraphics();
rosalila_graphics->video(rosalila_graphics);
}
Game::~Game()
{
//dtor
}
void Game::dispose()
{
if (screen != NULL) screen->hide();
}
void Game::pause()
{
if (screen != NULL) screen->pause();
}
void Game::resume()
{
if (screen != NULL) screen->resume();
}
void Game::render()
{
if (screen != NULL) screen->render(rosalila_graphics);
receiver->updateInputs();
rosalila_graphics->updateScreen();
if(receiver->isKeyDown(SDLK_ESCAPE))
exit(0);
}
void Game::setScreen(Screen *screen)
{
if (this->screen != NULL) this->screen->hide();
this->screen = screen;
if (this->screen != NULL) {
this->screen->show();
}
}
Screen* Game::getScreen()
{
return screen;
}