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