]> git.localhorst.tv Git - l2e.git/blob - src/menu/CapsuleNameMenu.h
4bc4d011ddf37c2c09ef75ba80589ca3d3e01748
[l2e.git] / src / menu / CapsuleNameMenu.h
1 #ifndef MENU_CAPSULENAMEMENU_H_
2 #define MENU_CAPSULENAMEMENU_H_
3
4 namespace common {
5         class Capsule;
6 }
7 namespace math {
8         template<class>
9         class Vector;
10 }
11 namespace menu {
12         class CapsuleMenu;
13 }
14
15 #include "../app/State.h"
16 #include "../graphics/CharSelect.h"
17
18 namespace menu {
19
20 class CapsuleMenu;
21
22 class CapsuleNameMenu
23 : public app::State {
24
25 public:
26         explicit CapsuleNameMenu(CapsuleMenu *parent);
27
28 public:
29         virtual void HandleEvents(const app::Input &);
30         virtual void UpdateWorld(Uint32 deltaT);
31         virtual void Render(SDL_Surface *);
32
33 public:
34         int Width() const;
35         int Height() const;
36
37 private:
38         virtual void OnEnterState(SDL_Surface *screen);
39         virtual void OnExitState(SDL_Surface *screen);
40         virtual void OnResumeState(SDL_Surface *screen);
41         virtual void OnPauseState(SDL_Surface *screen);
42
43         virtual void OnResize(int width, int height);
44
45         common::Capsule &GetCapsule();
46         const common::Capsule &GetCapsule() const;
47
48         void AddChar();
49         void RemoveChar();
50         void StoreName();
51
52         void RenderName(SDL_Surface *screen, const math::Vector<int> &offset) const;
53         void RenderAlphabet(SDL_Surface *screen, const math::Vector<int> &offset) const;
54
55 private:
56         CapsuleMenu *parent;
57         graphics::CharSelect select;
58         int cursor;
59         char buffer[6];
60         bool first;
61
62 };
63
64 }
65
66 #endif /* MENU_CAPSULENAMEMENU_H_ */