-
Notifications
You must be signed in to change notification settings - Fork 2
/
IGameScreen.h
53 lines (43 loc) · 1.03 KB
/
IGameScreen.h
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
#pragma once
namespace NeroEngine{
class IMainGame;
enum class ScreenState
{
NONE,
RUNNING,
EXIT_APPLICATION,
CHANGE_NEXT,
CHANGE_PREVIOUS
};
class IGameScreen
{
public:
friend class ScreenList;
IGameScreen();
virtual~IGameScreen();
//when change screen
virtual int getNextScreenIndex() const = 0;
virtual int getPreviousScreenIndex() const = 0;
//called at begin of application & end of application
virtual void build() = 0;
virtual void destroy() = 0;
//called when a screen enters and exits focus
virtual void onEntry() = 0;
virtual void onExit() = 0;
//main game loop
virtual void update() = 0;
virtual void draw() = 0;
int getScreenIndex() const{
return _screenIndex;
}
ScreenState getScreenState() const{ return _screenState; }
void setRunning(){ _screenState = ScreenState::RUNNING; }
void setParentGame(IMainGame* game){
m_game = game;
}
protected:
ScreenState _screenState = ScreenState::NONE;
IMainGame* m_game = nullptr;
int _screenIndex = -1;
};
}