YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
MainMenuScreen.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Gui/GuiManager.hpp
"
2
#include "
YAPOG/Graphics/Gui/PictureBox.hpp
"
3
#include "
YAPOG/System/RandomHelper.hpp
"
4
#include "
YAPOG/Audio/AudioManager.hpp
"
5
#include "
YAPOG/Graphics/Game/Sprite/Sprite.hpp
"
6
7
#include "
GameScreen/RegistrationScreen.hpp
"
8
#include "
GameScreen/MainMenuScreen.hpp
"
9
#include "
Gui/MainMenu.hpp
"
10
11
namespace
ycl
12
{
13
const
yap::ScreenType
MainMenuScreen::DEFAULT_NAME
=
"MainMenu"
;
14
15
MainMenuScreen::MainMenuScreen
(
yap::IDrawingContext
& context)
16
:
BaseScreen
(DEFAULT_NAME, context)
17
{
18
}
19
20
MainMenuScreen::~MainMenuScreen
()
21
{
22
}
23
24
void
MainMenuScreen::HandleInit
()
25
{
26
BaseScreen::HandleInit
();
27
28
MainMenu
* mainMenu =
new
MainMenu
();
29
mainMenu->
Init
();
30
31
yap::PictureBox
* bg =
new
yap::PictureBox
();
32
33
yap::RandomHelper
* random;
34
int
nb = random->
GetNext
(0, 4242) % 5;
35
switch
(nb)
36
{
37
case
0:
38
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/mew.jpg"
));
39
break
;
40
case
1:
41
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/fete.jpg"
));
42
break
;
43
case
2:
44
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/rondoudou.jpg"
));
45
break
;
46
case
3:
47
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/dresseur.jpg"
));
48
break
;
49
case
4:
50
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/ronflex.gif"
));
51
break
;
52
default
:
53
bg->
SetPicture
(
new
yap::Sprite
(
"WindowSkins/BasicSkin/Background/ronflex.gif"
));
54
break
;
55
}
56
bg->
SetSize
(
yap::Vector2
(800, 600));
57
guiManager_
->
AddChild
(*bg);
58
59
mainMenu->
GetLoginItem
().
OnActivated
+=
60
[&] (
const
yap::MenuItem
& sender,
const
yap::EmptyEventArgs
& args)
61
{
62
nextScreen_
=
"Login"
;
63
};
64
65
mainMenu->
GetRegistrationItem
().
OnActivated
+=
66
[&] (
const
yap::MenuItem
& sender,
const
yap::EmptyEventArgs
& args)
67
{
68
nextScreen_
=
"Registration"
;
69
};
70
71
mainMenu->
GetExitItem
().
OnActivated
+=
72
[&] (
const
yap::MenuItem
& sender,
const
yap::EmptyEventArgs
& args)
73
{
74
ExitGame
();
75
};
76
77
guiManager_
->
AddChild
(*mainMenu);
78
79
yap::AudioManager::Instance
().
PlayMusic
(
"BGM/Opening.ogg"
);
80
}
81
82
void
MainMenuScreen::HandleRun
(
83
const
yap::Time
& dt,
84
yap::IDrawingContext
& context)
85
{
86
BaseScreen::HandleRun
(dt, context);
87
}
88
}
// namespace ycl
YAPOG.Client
src
GameScreen
MainMenuScreen.cpp
Generated on Mon Sep 17 2012 22:24:21 for YAPOG by
1.8.1.1