]> git.localhorst.tv Git - l2e.git/blob - src/battle/states/PerformAttacks.h
de20f76cbeaa267ccd5f6a08eb96f0a3094f4dce
[l2e.git] / src / battle / states / PerformAttacks.h
1 /*
2  * PerformAttacks.h
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: holy
6  */
7
8 #ifndef BATTLE_PERFORMATTACKS_H_
9 #define BATTLE_PERFORMATTACKS_H_
10
11 #include "../../app/State.h"
12
13 #include "../NumberAnimation.h"
14 #include "../../math/Vector.h"
15 #include "../../graphics/Animation.h"
16
17 #include <vector>
18
19 namespace battle {
20
21 class BattleState;
22 class TargetSelection;
23
24 class PerformAttacks
25 : public app::State {
26
27 public:
28         explicit PerformAttacks(BattleState *battle)
29         : battle(battle), moveAnimation(0), targetAnimation(0), titleBarText(0), cursor(-1) { }
30
31 public:
32         virtual void HandleEvents(const app::Input &);
33         virtual void UpdateWorld(float deltaT);
34         virtual void Render(SDL_Surface *);
35
36 private:
37         virtual void OnEnterState(SDL_Surface *screen);
38         virtual void OnExitState(SDL_Surface *screen);
39         virtual void OnResumeState(SDL_Surface *screen);
40         virtual void OnPauseState(SDL_Surface *screen);
41
42         virtual void OnResize(int width, int height);
43
44 private:
45         void CheckAnimations();
46         bool HasAnimationsRunning() const;
47         void ResetAnimation();
48
49 private:
50         void AddNumberAnimations(const TargetSelection &);
51
52         void RenderTitleBar(SDL_Surface *screen, const math::Vector<int> &offset) const;
53         void RenderNumbers(SDL_Surface *screen, const math::Vector<int> &offset) const;
54         void RenderTargetAnimation(SDL_Surface *screen, const math::Vector<int> &offset) const;
55
56 private:
57         BattleState *battle;
58         graphics::AnimationRunner moveAnimation;
59         graphics::AnimationRunner targetAnimation;
60         const char *titleBarText;
61         app::Timer<Uint32> titleBarTimer;
62         app::Timer<Uint32> targetAnimationTimer;
63         std::vector<NumberAnimation> numberAnimation;
64         std::vector<math::Vector<int> > numberPosition;
65         int cursor;
66
67 };
68
69 }
70
71 #endif /* BATTLE_PERFORMATTACKS_H_ */