YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GameScreen.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Game/GameScreen.hpp
"
2
#include "
YAPOG/Graphics/IDrawingContext.hpp
"
3
#include "
YAPOG/Graphics/Gui/GuiManager.hpp
"
4
5
namespace
yap
6
{
7
GameScreen::GameScreen
(
const
ScreenType
& type)
8
: nextScreen_ (type)
9
, guiManager_ (nullptr)
10
, type_ (type)
11
{
12
}
13
14
GameScreen::~GameScreen
()
15
{
16
delete
guiManager_
;
17
guiManager_
=
nullptr
;
18
}
19
20
void
GameScreen::Init
()
21
{
22
HandleInit
();
23
}
24
25
void
GameScreen::Activate
()
26
{
27
HandleActivate
();
28
}
29
30
void
GameScreen::Deactivate
()
31
{
32
HandleDeactivate
();
33
}
34
35
void
GameScreen::NextFrame
()
36
{
37
nextScreen_
=
type_
;
38
}
39
40
const
ScreenType
&
GameScreen::Run
(
const
Time
& dt,
IDrawingContext
& context)
41
{
42
HandleRun
(dt, context);
43
44
context.
SetMode
(
"Gui"
);
45
46
guiManager_
->
Update
(dt);
47
guiManager_
->
Draw
(context);
48
49
context.
SetDefaultCamera
();
50
51
return
nextScreen_
;
52
}
53
54
const
GuiManager
&
GameScreen::GetGuiManager
()
const
55
{
56
return
*
guiManager_
;
57
}
58
59
GuiManager
&
GameScreen::GetGuiManager
()
60
{
61
return
*
guiManager_
;
62
}
63
64
const
ScreenType
&
GameScreen::GetType
()
const
65
{
66
return
type_
;
67
}
68
69
Event<IGameScreen&>
&
GameScreen::OnGameExitedEvent
()
70
{
71
return
OnGameExited
;
72
}
73
74
bool
GameScreen::OnEvent
(
const
GuiEvent
& guiEvent)
75
{
76
if
(
guiManager_
->
OnEvent
(guiEvent))
77
return
true
;
78
79
return
HandleOnEvent
(guiEvent);
80
}
81
82
bool
GameScreen::OnPriorityEvent
(
const
GuiEvent
& guiEvent)
83
{
84
if
(
HandleOnPriorityEvent
(guiEvent))
85
return
true
;
86
87
return
guiManager_
->
OnPriorityEvent
(guiEvent);
88
}
89
90
void
GameScreen::ExitGame
()
91
{
92
OnGameExited
(*
this
,
EmptyEventArgs
());
93
}
94
95
void
GameScreen::CreateGuiManager
()
96
{
97
guiManager_
=
new
GuiManager
();
98
}
99
100
void
GameScreen::HandleRun
(
101
const
Time
& dt,
102
IDrawingContext
& context)
103
{
104
}
105
106
void
GameScreen::HandleInit
()
107
{
108
CreateGuiManager
();
109
}
110
111
void
GameScreen::HandleActivate
()
112
{
113
}
114
115
void
GameScreen::HandleDeactivate
()
116
{
117
}
118
119
bool
GameScreen::HandleOnEvent
(
const
GuiEvent
& guiEvent)
120
{
121
return
false
;
122
}
123
124
bool
GameScreen::HandleOnPriorityEvent
(
const
GuiEvent
& guiEvent)
125
{
126
return
false
;
127
}
128
}
// namespace yap
YAPOG
src
YAPOG
Graphics
Game
GameScreen.cpp
Generated on Mon Sep 17 2012 22:24:25 for YAPOG by
1.8.1.1