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