]> git.localhorst.tv Git - l2e.git/blob - src/menu/PartyMenu.h
08ffa3823b46c1a8a6b07db38f6982fd75fdb398
[l2e.git] / src / menu / PartyMenu.h
1 #ifndef MENU_PARTYMENU_H_
2 #define MENU_PARTYMENU_H_
3
4 #include "fwd.h"
5 #include "HeroStatus.h"
6 #include "../app/State.h"
7 #include "../common/fwd.h"
8 #include "../geometry/Vector.h"
9 #include "../graphics/Menu.h"
10
11 namespace menu {
12
13 class PartyMenu
14 : public app::State {
15
16 public:
17         explicit PartyMenu(common::GameConfig *);
18         virtual ~PartyMenu();
19
20 public:
21         virtual void HandleEvents(const app::Input &);
22         virtual void UpdateWorld(float deltaT);
23         virtual void Render(SDL_Surface *);
24
25 public:
26         common::GameConfig &Game() { return *game; }
27         const common::GameConfig &Game() const { return *game; }
28         Resources &Res();
29         const Resources &Res() const;
30
31         int Width() const;
32         int Height() const;
33
34 public:
35         void RenderBackground(SDL_Surface *screen) const;
36         void RenderHeros(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
37         void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
38         void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
39
40         geometry::Vector<int> StatusOffset(int index) const;
41         const HeroStatus &GetHeroStatus(int index) const { return status[index]; }
42
43         static void OnEquipSelect(void *, int);
44         static void OnSpellSelect(void *, int);
45         static void OnStatusSelect(void *, int);
46
47 private:
48         virtual void OnEnterState(SDL_Surface *screen);
49         virtual void OnExitState(SDL_Surface *screen);
50         virtual void OnResumeState(SDL_Surface *screen);
51         virtual void OnPauseState(SDL_Surface *screen);
52
53         virtual void OnResize(int width, int height);
54
55 private:
56         enum MenuItem {
57                 MENU_ITEM_ITEM,
58                 MENU_ITEM_SPELL,
59                 MENU_ITEM_CAPSULE,
60                 MENU_ITEM_EQUIP,
61                 MENU_ITEM_STATUS,
62                 MENU_ITEM_CHANGE,
63                 MENU_ITEM_CONFIG,
64                 MENU_ITEM_SCENARIO,
65         };
66
67 private:
68         HeroStatus status[4];
69         geometry::Vector<int> statusPositions[4];
70         common::GameConfig *game;
71         graphics::Menu<int> mainMenu;
72
73 };
74
75 }
76
77 #endif /* MENU_PARTYMENU_H_ */