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