-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseState.h
36 lines (30 loc) · 1021 Bytes
/
BaseState.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
#pragma once
enum class StateType
{
Intro, MainMenu, Play, Pause, GameOver, Credits
};
class BaseState
{
public:
BaseState(StateType type, bool transparent = false, bool transcendent = false)
: m_type(type), m_isTranscendent(transcendent), m_isTransparent(transparent), m_isActive(true) { }
virtual ~BaseState() = default;
virtual void update(float delta = 0.f) = 0;
virtual void render() = 0;
virtual void activate() { m_isActive = true; }
virtual void deactivate() { m_isActive = false; }
virtual void onResize() {}
private:
StateType m_type;
bool m_isTranscendent;
bool m_isTransparent;
bool m_isActive;
public:
//Setters and getters
StateType getType() const { return m_type; }
bool setTranscendent(bool transcendent) { m_isTranscendent = transcendent; }
bool getTranscendent() const { return m_isTranscendent; }
bool setTransparent(bool transparent) { m_isTranscendent = transparent; }
bool getTransparent() const { return m_isTransparent; }
bool isActive() const { return m_isActive; }
};