-
Notifications
You must be signed in to change notification settings - Fork 0
/
cs_202ProjectApp.cpp
72 lines (62 loc) · 1.5 KB
/
cs_202ProjectApp.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
// cs_202ProjectApp.cpp
// this dungeon game was created by Ross Spicer, John Cheshire
// Andrew Clark, Chay Davis, and Jesse Arbuckle
// this file contais the class that cinder uses to create the app
#include "Messenger.h"
#include "UIMessenger.h"
#include "ImportantMessage.h"
#include "Player.h"
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "dungeon.h"
#include "ui.h"
#include "Sound.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class DungeonOfEvil : public AppBasic {
public:
void setup();
void keyDown( KeyEvent event );
void update();
void draw();
private:
Dungeon _theDungeon;
UI _theUI;
Messenger _msgEngine;
UIMessenger _uiMsg;
Player _player;
ImportantMessage _splashScreen;
bool _firstRun;
};
void DungeonOfEvil::setup()
{
Rand::randomize();
_player = Player(_msgEngine);
_theDungeon = Dungeon();
_uiMsg = UIMessenger(_player);
_firstRun = true;
}
void DungeonOfEvil::keyDown( KeyEvent event )
{
_theUI.keyDown(event.getChar() , _theDungeon, _player, _splashScreen);
}
void DungeonOfEvil::update()
{
if(_firstRun)
{
_splashScreen.splashMessage("Welcome to the game!\nPress A, W, D to move.\nSpace and m for attack and magic.\nh and g for potions.", 5, false);
_firstRun = false;
}
_uiMsg.update();
}
void DungeonOfEvil::draw()
{
// clear out the window with black
//gl::clear( Color( 0, 0, 0 ) );
_theDungeon.draw();
_msgEngine.draw();
_uiMsg.draw();
_splashScreen.draw();
}
CINDER_APP_BASIC( DungeonOfEvil, RendererGl )