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