YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
SplashScreen.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Game/Sprite/Sprite.hpp
"
2
#include "
YAPOG/Graphics/Texture.hpp
"
3
#include "
YAPOG/Game/Factory/ObjectFactory.hpp
"
4
#include "
YAPOG/Graphics/Gui/GuiManager.hpp
"
5
#include "
YAPOG/Graphics/Gui/GameInput/GameInputManager.hpp
"
6
#include "
YAPOG/Graphics/IDrawingContext.hpp
"
7
8
#include "
GameScreen/SplashScreen.hpp
"
9
10
namespace
ycl
11
{
12
const
yap::ScreenType
SplashScreen::DEFAULT_NAME
=
"Splash"
;
13
const
yap::String
SplashScreen::DEFAULT_SPLASH_TEXT
=
"Appuyez sur Start !"
;
14
15
SplashScreen::SplashScreen
(
yap::IDrawingContext
& context)
16
:
BaseScreen
(DEFAULT_NAME, context)
17
, logo_ (nullptr)
18
, splashText_ (DEFAULT_SPLASH_TEXT)
19
{
20
}
21
22
SplashScreen::~SplashScreen
()
23
{
24
}
25
26
void
SplashScreen::HandleInit
()
27
{
28
BaseScreen::HandleInit
();
29
30
logo_
=
new
yap::Sprite
(
yap::ObjectFactory::Instance
().
31
Create<yap::Texture> (
"Texture"
,
yap::ID
(100)));
32
33
logo_
->
Scale
(
yap::Vector2
(0.42f, 0.42f));
34
logo_
->
SetPosition
(
yap::Vector2
(
35
800 / 2 -
logo_
->
GetSize
().x / 2,
36
600 / 2 -
logo_
->
GetSize
().y / 2));
37
38
splashText_
.
ChangeColor
(sf::Color::Black);
39
splashText_
.
SetPosition
(
40
yap::Vector2
(
41
400 -
splashText_
.
GetSize
().x / 2,
42
450.0f));
43
guiManager_
->
AddChild
(
splashText_
);
44
}
45
46
void
SplashScreen::HandleActivate
()
47
{
48
yap::GameScreen::HandleActivate
();
49
50
context_
.
SetTargetClearColor
(sf::Color::White);
51
}
52
53
void
SplashScreen::HandleRun
(
54
const
yap::Time
& dt,
55
yap::IDrawingContext
& context)
56
{
57
logo_
->
Draw
(context);
58
59
BaseScreen::HandleRun
(dt, context);
60
}
61
62
bool
SplashScreen::HandleOnEvent
(
const
yap::GuiEvent
& guiEvent)
63
{
64
if
(
gameInputManager_
.
GameInputIsActivated
(
65
yap::GameInputType::Action
,
66
guiEvent))
67
{
68
nextScreen_
=
"MainMenu"
;
69
return
true
;
70
}
71
72
return
false
;
73
}
74
}
// namespace ycl
YAPOG.Client
src
GameScreen
SplashScreen.cpp
Generated on Mon Sep 17 2012 22:24:21 for YAPOG by
1.8.1.1