]> git.localhorst.tv Git - l2e.git/blob - src/battle/BattleState.h
added Input class for handling user input
[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 "Hero.h"
12 #include "Monster.h"
13 #include "../app/State.h"
14 #include "../geometry/Point.h"
15 #include "../geometry/Vector.h"
16
17 #include <vector>
18 #include <SDL.h>
19
20 namespace app { class Input; }
21
22 namespace battle {
23
24 class PartyLayout;
25
26 class BattleState
27 : public app::State {
28
29 public:
30         BattleState(SDL_Surface *background, const PartyLayout &monstersLayout, const PartyLayout &heroesLayout)
31         : background(background)
32         , monstersLayout(&monstersLayout)
33         , heroesLayout(&heroesLayout) { }
34
35 public:
36         void AddMonster(const Monster &);
37         void AddHero(const Hero &);
38
39 public:
40         virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
41         virtual void ExitState();
42
43         virtual void Resize(int width, int height);
44
45         virtual void HandleInput(const app::Input &);
46         virtual void UpdateWorld(float deltaT);
47         virtual void Render(SDL_Surface *);
48
49 private:
50         void RenderBackground(SDL_Surface *screen, const geometry::Vector<int> &offset);
51         void RenderMonsters(SDL_Surface *screen, const geometry::Vector<int> &offset);
52         void RenderHeroes(SDL_Surface *screen, const geometry::Vector<int> &offset);
53
54 private:
55         SDL_Surface *background;
56         const PartyLayout *monstersLayout;
57         const PartyLayout *heroesLayout;
58         std::vector<geometry::Point<int> > monsterPositions;
59         std::vector<geometry::Point<int> > heroesPositions;
60         std::vector<Monster> monsters;
61         std::vector<Hero> heroes;
62
63 };
64
65 }
66
67 #endif /* BATTLE_BATTLESTATE_H_ */