YAPOG  0.0.1
Yet Another Pokemon Online Game
BattleSpawnerArea.cpp
Go to the documentation of this file.
5 
6 namespace yap
7 {
9 
12 
15 
17  : MapArea (id)
18  , width_ (DEFAULT_WIDTH)
19  , height_ (DEFAULT_HEIGHT)
20  , battleSpawningArea_ ()
21  {
22  }
23 
25  {
26  }
27 
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,
45  height_ * DEFAULT_CELL_SIZE);
46 
47  SetArea (area);
48 
49  HandleInitArea (width, height);
50  }
51 
53  {
54  return width_;
55  }
56 
58  {
59  return height_;
60  }
61 
63  const FloatRect& battleSpawningArea)
64  {
65  battleSpawningArea_ = battleSpawningArea;
66 
68  }
69 
71  {
72  }
73 
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),
85 
86  battleSpawningEvent->AddAction (new TriggerBattleMapEventAction (*this));
87 
88  AddEvent (battleSpawningEvent);
89  }
90 } // namespace yap