YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PokemonFighter.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Game/Sprite/ISprite.hpp
"
2
#include "Battle/PokemonFighter.hpp"
3
#include "Pokemon/Pokemon.hpp"
4
5
namespace
ycl
6
{
7
const
bool
PokemonFighter::DEFAULT_VISIBLE_STATE
=
true
;
8
const
sf::Color
PokemonFighter::DEFAULT_COLOR
= sf::Color ();
9
const
BattleSpriteType
PokemonFighter::
10
DEFAULT_BATTLE_SPRITE_TYPE
=
BattleSpriteType::FRONT
;
11
12
PokemonFighter::PokemonFighter
(
Pokemon
* originalPokemon,
bool
isOpponent)
13
: yap::
PokemonFighter
(originalPokemon)
14
, isVisible_ (DEFAULT_VISIBLE_STATE)
15
, originalPokemon_ (originalPokemon)
16
, battleSprite_ (nullptr)
17
, isOpponent_ (isOpponent)
18
{
19
if
(
isOpponent_
)
20
SetBattleSprite
(
BattleSpriteType::FRONT
);
21
else
22
SetBattleSprite
(
BattleSpriteType::BACK
);
23
}
24
25
PokemonFighter::~PokemonFighter
()
26
{
27
}
28
31
void
PokemonFighter::Draw
(
yap::IDrawingContext
& context)
32
{
33
if
(!
IsVisible
())
34
return
;
35
36
HandleDraw
(context);
37
}
38
39
bool
PokemonFighter::IsVisible
()
const
40
{
41
return
isVisible_
;
42
}
43
44
void
PokemonFighter::Show
(
bool
isVisible)
45
{
46
isVisible_
= isVisible;
47
48
HandleShow
(isVisible);
49
}
50
51
void
PokemonFighter::ChangeColor
(
const
sf::Color& color)
52
{
53
color_
= color;
54
55
HandleChangeColor
(color);
56
}
58
59
void
PokemonFighter::HandleInit
()
60
{
61
}
62
63
void
PokemonFighter::HandleUpdate
(
const
yap::Time
& dt)
64
{
65
}
66
67
void
PokemonFighter::HandleDraw
(
yap::IDrawingContext
& context)
68
{
69
battleSprite_
->
Draw
(context);
70
}
71
72
void
PokemonFighter::HandleShow
(
bool
isVisible)
73
{
74
}
75
76
void
PokemonFighter::HandleChangeColor
(
const
sf::Color& color)
77
{
78
}
79
82
yap::ISprite
&
PokemonFighter::GetBattleSprite
()
83
{
84
return
*
battleSprite_
;
85
}
87
88
void
PokemonFighter::SetBattleSprite
(
89
const
BattleSpriteType
& battleSpriteType)
90
{
91
switch
(battleSpriteType)
92
{
93
case
BattleSpriteType::BACK
:
94
battleSprite_
= &
originalPokemon_
->
GetBattleBack
();
95
break
;
96
case
BattleSpriteType::FRONT
:
97
battleSprite_
= &
originalPokemon_
->
GetBattleFront
();
98
break
;
99
default
:
100
SetBattleSprite
(
DEFAULT_BATTLE_SPRITE_TYPE
);
101
break
;
102
}
103
}
104
105
}
// namespace yap
YAPOG.Client
src
Battle
PokemonFighter.cpp
Generated on Mon Sep 17 2012 22:24:24 for YAPOG by
1.8.1.1