]> git.localhorst.tv Git - l2e.git/blob - src/battle/states/PerformAttacks.h
added Maxim's melee animation
[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/ComplexAnimation.h"
17
18 #include <vector>
19
20 namespace battle {
21
22 class AttackAnimation;
23
24 class PerformAttacks
25 : public app::State {
26
27 public:
28         explicit PerformAttacks(BattleState *battle)
29         : ctrl(0), battle(battle), moveAnimation(0), attackAnimation(0), titleBarText(0), cursor(-1) { }
30
31 public:
32         virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
33         virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
34         virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
35         virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
36
37         virtual void Resize(int width, int height);
38
39         virtual void HandleEvents(const app::Input &);
40         virtual void UpdateWorld(float deltaT);
41         virtual void Render(SDL_Surface *);
42
43 private:
44         void CheckNumberAnimation();
45         bool HasAnimationsRunning() const;
46         void ResetAnimation();
47         void AdvanceCursor();
48         bool Finished() const { return cursor >= int(order.size()); }
49
50 private:
51         void RenderTitleBar(SDL_Surface *screen, const geometry::Vector<int> &offset);
52         void RenderNumbers(SDL_Surface *screen, const geometry::Vector<int> &offset);
53
54 private:
55         app::Application *ctrl;
56         BattleState *battle;
57         graphics::Animation *moveAnimation;
58         AttackAnimation *attackAnimation;
59         const char *titleBarText;
60         app::Timer<Uint32> titleBarTimer;
61         std::vector<BattleState::Order> order;
62         std::vector<NumberAnimation> numberAnimation;
63         std::vector<geometry::Point<int> > numberPosition;
64         int cursor;
65
66 };
67
68 }
69
70 #endif /* BATTLE_PERFORMATTACKS_H_ */