-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.hpp
71 lines (52 loc) · 1.73 KB
/
game.hpp
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
#ifndef GAME_HPP
#define GAME_HPP
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace gui;
class Ball;
class Racket;
class Frame;
class Game :IEventReceiver
{
private:
vector2d<int> m_screen_size;
IrrlichtDevice* m_device;
IVideoDriver* m_video_driver;
ISceneManager* m_scene_manager;
IGUIEnvironment* m_gui_env;
ICursorControl* m_cursor;
vector3df m_hmap_size;
int m_ball_number;
vector2df m_racket_size;
Ball* m_ball;
Racket* m_player_racket;
Racket* m_ai_racket;
ISceneNode* m_ball_node;
IMeshSceneNode* m_player_racket_node;
IMeshSceneNode* m_ai_racket_node;
Frame* m_frame;
bool m_run;
u32 m_timer;
IGUIStaticText* m_timer_text;
Game(vector2d<int> screen_size, vector3df map_size, int ball_number);
void changeColorInMeshBuffer(IMeshBuffer* mb, const SColor& color);
void initPlayerRacket();
void initAiRacket();
bool init();
void drawFrameElement(int z, SColor color);
void drawFrame();
void render();
void playerRacketControl();
void aiRacketControl();
void animate(int dt);
bool OnEvent(const SEvent& event);
public:
static Game* createGame(vector2d<int> screen_size = vector2d<int>(640, 480),
vector3df map_size = vector3df(15, 10, 25), int ball_number = 5);
void play();
~Game();
};
#endif