YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PokemonSingleMoveInfoWidget.cpp
Go to the documentation of this file.
1
#include "
YAPOG/System/StringHelper.hpp
"
2
#include "
YAPOG/Graphics/Gui/WidgetBackground.hpp
"
3
#include "
YAPOG/Graphics/Gui/WidgetBorder.hpp
"
4
#include "
YAPOG/Graphics/Gui/HorizontalLayout.hpp
"
5
#include "
YAPOG/Graphics/Gui/VerticalLayout.hpp
"
6
#include "
YAPOG/Graphics/Gui/PictureBox.hpp
"
7
#include "
YAPOG/Graphics/Gui/MultiLabelWidget.hpp
"
8
#include "
YAPOG/Game/Pokemon/PokemonInfo.hpp
"
9
#include "
YAPOG/Graphics/Game/Sprite/ISprite.hpp
"
10
#include "
YAPOG/Graphics/Game/Sprite/Sprite.hpp
"
11
#include "
YAPOG/Game/Pokemon/PokemonMove.hpp
"
12
13
#include "
Gui/PokemonSingleMoveInfoWidget.hpp
"
14
#include "Pokemon/Pokemon.hpp"
15
16
namespace
ycl
17
{
18
PokemonSingleMoveInfoWidget::PokemonSingleMoveInfoWidget
()
19
: name_ (nullptr)
20
, pp_ (nullptr)
21
, type_ (nullptr)
22
, mainLayout_ ()
23
, nameAndTypeLayout_ (nullptr)
24
, ppLayout_ (nullptr)
25
{
26
// Labels
27
name_
=
new
yap::Label
();
28
pp_
=
new
yap::Label
();
29
30
// PictureBox
31
type_
=
new
yap::PictureBox
();
32
33
// Layouts
34
mainLayout_
=
new
yap::VerticalLayout
(
35
yap::Padding
(),
yap::Padding
(),
false
);
36
37
nameAndTypeLayout_
=
new
yap::HorizontalLayout
(
38
yap::Padding
(),
yap::Padding
(0, 10, 0, 0),
false
);
39
40
ppLayout_
=
new
yap::VerticalLayout
(
41
yap::Padding
(),
yap::Padding
(),
false
);
42
}
43
44
void
PokemonSingleMoveInfoWidget::Init
()
45
{
46
SetSize
(
yap::Vector2
(393, 94));
47
48
// Set layouts size
49
mainLayout_
->
SetSize
(
GetSize
());
50
nameAndTypeLayout_
->
SetSize
(
yap::Vector2
(393, 52));
51
ppLayout_
->
SetSize
(
yap::Vector2
(393, 42));
52
53
// Set the labels text size
54
name_
->
SetTextSize
(40);
55
pp_
->
SetTextSize
(40);
56
57
type_
->
SetPicture
(
new
yap::Sprite
(
"Pictures/Types/0.png"
));
58
59
// Hierarchy construction
60
nameAndTypeLayout_
->
AddChild
(*
type_
);
61
nameAndTypeLayout_
->
AddChild
(*
name_
);
62
63
ppLayout_
->
AddChild
(*
pp_
, yap::LayoutBox::Align::RIGHT);
64
65
mainLayout_
->
AddChild
(*
nameAndTypeLayout_
);
66
mainLayout_
->
AddChild
(*
ppLayout_
);
67
68
// Borders
69
/*
70
mainLayout_->SetBorder (*new yap::WidgetBorder ("Test/black.png"));
71
nameAndTypeLayout_->SetBorder (*new yap::WidgetBorder ("Test/red.png"));
72
ppLayout_->SetBorder (*new yap::WidgetBorder ("Test/blue.png"));
73
*/
74
75
AddChild
(*
mainLayout_
);
76
}
77
78
void
PokemonSingleMoveInfoWidget::SetPokemonMove
(
79
const
yap::PokemonMove
& move)
80
{
81
// Labels
82
name_
->
SetText
(move.
GetName
());
83
84
pp_
->
SetText
(
"PP "
+
85
yap::StringHelper::ToString
86
(static_cast<int>(move.
GetCurrentPP
()))
87
+
"/"
+
88
yap::StringHelper::ToString
89
(static_cast<int>(move.
GetMaxPP
())));
90
91
// PictureBoxes
92
type_
->
SetPicture
(
new
yap::Sprite
(
93
"Pictures/Types/"
+
94
yap::StringHelper::ToString
(
95
move.
GetType
().
GetID
().
GetValue
()) +
".png"
));
96
97
// Refresh
98
ppLayout_
->
Refresh
();
99
}
100
101
bool
PokemonSingleMoveInfoWidget::IsFocusable
()
const
102
{
103
return
false
;
104
}
105
106
void
PokemonSingleMoveInfoWidget::HandleMove
(
const
yap::Vector2
& offset)
107
{
108
109
}
110
void
PokemonSingleMoveInfoWidget::HandleScale
(
const
yap::Vector2
& factor)
111
{
112
113
}
114
void
PokemonSingleMoveInfoWidget::HandleDraw
(
yap::IDrawingContext
& offset)
115
{
116
117
}
118
void
PokemonSingleMoveInfoWidget::HandleShow
(
bool
isVisible)
119
{
120
}
121
void
PokemonSingleMoveInfoWidget::HandleChangeColor
(
const
sf::Color& color)
122
{
123
}
124
void
PokemonSingleMoveInfoWidget::HandleUpdate
(
const
yap::Time
& dt)
125
{
126
}
127
128
}
// namespace ycl
YAPOG.Client
src
Gui
PokemonSingleMoveInfoWidget.cpp
Generated on Mon Sep 17 2012 22:24:22 for YAPOG by
1.8.1.1