]> git.localhorst.tv Git - l2e.git/blob - src/battle/BattleState.h
added attack type selection menu in battle state
[l2e.git] / src / battle / BattleState.h
1 /*
2  * BattleState.h
3  *
4  *  Created on: Aug 5, 2012
5  *      Author: holy
6  */
7
8 #ifndef BATTLE_BATTLESTATE_H_
9 #define BATTLE_BATTLESTATE_H_
10
11 #include "AttackTypeMenu.h"
12 #include "Hero.h"
13 #include "Monster.h"
14 #include "../app/State.h"
15 #include "../geometry/Point.h"
16 #include "../geometry/Vector.h"
17
18 #include <vector>
19 #include <SDL.h>
20
21 namespace app { class Input; }
22 namespace graphics { class Sprite; }
23
24 namespace battle {
25
26 class PartyLayout;
27
28 // TODO: maybe split battle state into substates for each menu?
29 class BattleState
30 : public app::State {
31
32 public:
33         BattleState(SDL_Surface *background, const PartyLayout &monstersLayout, const PartyLayout &heroesLayout, const graphics::Sprite *attackIcons)
34         : background(background)
35         , monstersLayout(&monstersLayout)
36         , heroesLayout(&heroesLayout)
37         , attackTypeMenu(attackIcons) { }
38
39 public:
40         void AddMonster(const Monster &);
41         void AddHero(const Hero &);
42
43 public:
44         virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
45         virtual void ExitState();
46
47         virtual void Resize(int width, int height);
48
49         virtual void HandleInput(const app::Input &);
50         virtual void UpdateWorld(float deltaT);
51         virtual void Render(SDL_Surface *);
52
53 private:
54         void RenderBackground(SDL_Surface *screen, const geometry::Vector<int> &offset);
55         void RenderMonsters(SDL_Surface *screen, const geometry::Vector<int> &offset);
56         void RenderHeroes(SDL_Surface *screen, const geometry::Vector<int> &offset);
57
58 private:
59         SDL_Surface *background;
60         const PartyLayout *monstersLayout;
61         const PartyLayout *heroesLayout;
62         AttackTypeMenu attackTypeMenu;
63         std::vector<geometry::Point<int> > monsterPositions;
64         std::vector<geometry::Point<int> > heroesPositions;
65         std::vector<Monster> monsters;
66         std::vector<Hero> heroes;
67
68 };
69
70 }
71
72 #endif /* BATTLE_BATTLESTATE_H_ */