]> git.localhorst.tv Git - l2e.git/blob - src/menu/SelectHero.h
5e67152c68f392810289c5c3b629ea8cd5fbcc70
[l2e.git] / src / menu / SelectHero.h
1 /*
2  * SelectHero.h
3  *
4  *  Created on: Oct 22, 2012
5  *      Author: holy
6  */
7
8 #ifndef MENU_SELECTHERO_H_
9 #define MENU_SELECTHERO_H_
10
11 #include "fwd.h"
12 #include "../app/State.h"
13 #include "../app/Timer.h"
14 #include "../common/fwd.h"
15
16 #include <SDL.h>
17
18 namespace menu {
19
20 class SelectHero
21 : public app::State {
22
23 public:
24         typedef void (*Callback)(void *, int selection);
25
26 public:
27         SelectHero(app::State *parent, PartyMenu *partyMenu, void *ref, Callback, int initialHero = 0);
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         common::GameConfig &Game();
44         const common::GameConfig &Game() const;
45         Resources &Res();
46         const Resources &Res() const;
47
48         void SelectUp();
49         void SelectRight();
50         void SelectDown();
51         void SelectLeft();
52
53         void RenderCursor(SDL_Surface *screen) const;
54
55 private:
56         app::State *parent;
57         PartyMenu *partyMenu;
58         void *ref;
59         Callback callback;
60         app::Timer<Uint32> cursorBlink;
61         int cursor;
62
63 };
64
65 }
66
67 #endif /* MENU_SELECTHERO_H_ */