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