YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BattleSpawnerArea.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Game/World/Map/BattleSpawnerArea.hpp
"
2
#include "
YAPOG/Game/World/Map/MapEvent.hpp
"
3
#include "
YAPOG/Game/World/Map/Physics/BoundingBox.hpp
"
4
#include "
YAPOG/Game/World/Map/TriggerBattleMapEventAction.hpp
"
5
6
namespace
yap
7
{
8
const
uint
BattleSpawnerArea::DEFAULT_CELL_SIZE
= 32;
9
10
const
uint
BattleSpawnerArea::DEFAULT_WIDTH
= 1;
11
const
uint
BattleSpawnerArea::DEFAULT_HEIGHT
= 1;
12
13
const
int
BattleSpawnerArea::DEFAULT_BATTLE_SPAWNING_AREA_Z
= 0;
14
const
int
BattleSpawnerArea::DEFAULT_BATTLE_SPAWNING_AREA_H
= 1;
15
16
BattleSpawnerArea::BattleSpawnerArea
(
const
ID
&
id
)
17
:
MapArea
(id)
18
, width_ (DEFAULT_WIDTH)
19
, height_ (DEFAULT_HEIGHT)
20
, battleSpawningArea_ ()
21
{
22
}
23
24
BattleSpawnerArea::~BattleSpawnerArea
()
25
{
26
}
27
28
BattleSpawnerArea::BattleSpawnerArea
(
const
BattleSpawnerArea
& copy)
29
:
MapArea
(copy)
30
, width_ (copy.width_)
31
, height_ (copy.height_)
32
, battleSpawningArea_ (copy.battleSpawningArea_)
33
{
34
}
35
36
void
BattleSpawnerArea::InitArea
(
uint
width,
uint
height)
37
{
38
width_
= width;
39
height_
= height;
40
41
FloatRect
area (
42
0,
43
0,
44
width_
*
DEFAULT_CELL_SIZE
,
45
height_
* DEFAULT_CELL_SIZE);
46
47
SetArea
(area);
48
49
HandleInitArea
(width, height);
50
}
51
52
const
uint
&
BattleSpawnerArea::GetWidth
()
const
53
{
54
return
width_
;
55
}
56
57
const
uint
&
BattleSpawnerArea::GetHeight
()
const
58
{
59
return
height_
;
60
}
61
62
void
BattleSpawnerArea::SetBattleSpawningArea
(
63
const
FloatRect
& battleSpawningArea)
64
{
65
battleSpawningArea_
= battleSpawningArea;
66
67
InitBattleSpawningEvent
(
battleSpawningArea_
);
68
}
69
70
void
BattleSpawnerArea::HandleInitArea
(
uint
width,
uint
height)
71
{
72
}
73
74
void
BattleSpawnerArea::InitBattleSpawningEvent
(
75
const
FloatRect
& battleSpawningArea)
76
{
77
MapEvent
* battleSpawningEvent =
new
MapEvent
();
78
79
battleSpawningEvent->
AddBoundingBox
(
80
new
BoundingBox
(
81
Vector2
(battleSpawningArea.left, battleSpawningArea.top),
82
Vector2
(battleSpawningArea.width, battleSpawningArea.height),
83
DEFAULT_BATTLE_SPAWNING_AREA_Z
,
84
DEFAULT_BATTLE_SPAWNING_AREA_H
));
85
86
battleSpawningEvent->
AddAction
(
new
TriggerBattleMapEventAction
(*
this
));
87
88
AddEvent
(battleSpawningEvent);
89
}
90
}
// namespace yap
YAPOG
src
YAPOG
Game
World
Map
BattleSpawnerArea.cpp
Generated on Mon Sep 17 2012 22:24:25 for YAPOG by
1.8.1.1