]> git.localhorst.tv Git - l2e.git/blob - src/menu/PartyMenu.cpp
added hero status tags in party menu
[l2e.git] / src / menu / PartyMenu.cpp
1 /*
2  * PartyMenu.cpp
3  *
4  *  Created on: Oct 21, 2012
5  *      Author: holy
6  */
7
8 #include "PartyMenu.h"
9
10 #include "Resources.h"
11 #include "../app/Application.h"
12 #include "../app/Input.h"
13 #include "../common/GameConfig.h"
14 #include "../common/GameState.h"
15 #include "../geometry/Vector.h"
16 #include "../graphics/Font.h"
17 #include "../graphics/Texture.h"
18
19 using app::Input;
20 using common::GameConfig;
21 using geometry::Vector;
22
23 namespace menu {
24
25 PartyMenu::PartyMenu(GameConfig *game)
26 : game(game) {
27         for (int i(0); i < 4; ++i) {
28                 status[i].SetHero(game->state->party[i]);
29                 status[i].SetResources(game->menuResources);
30         }
31         status[1].SetPosition(Vector<int>(status[0].Width() + Res().normalFont->CharWidth(), 0));
32         status[2].SetPosition(Vector<int>(0, status[0].Height() + Res().normalFont->CharHeight()));
33         status[3].SetPosition(Vector<int>(status[0].Width() + Res().normalFont->CharWidth(), status[0].Height() + Res().normalFont->CharHeight()));
34 }
35
36 PartyMenu::~PartyMenu() {
37
38 }
39
40
41 void PartyMenu::OnEnterState(SDL_Surface *) {
42
43 }
44
45 void PartyMenu::OnExitState(SDL_Surface *) {
46
47 }
48
49 void PartyMenu::OnResumeState(SDL_Surface *) {
50
51 }
52
53 void PartyMenu::OnPauseState(SDL_Surface *) {
54
55 }
56
57
58 void PartyMenu::OnResize(int width, int height) {
59
60 }
61
62
63 void PartyMenu::HandleEvents(const Input &input) {
64         if (input.JustPressed(Input::ACTION_B)) {
65                 Ctrl().PopState();
66                 return;
67         }
68 }
69
70 void PartyMenu::UpdateWorld(float deltaT) {
71
72 }
73
74 void PartyMenu::Render(SDL_Surface *screen) {
75         Res().menubg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
76         RenderHeros(screen, Vector<int>());
77 }
78
79 void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
80         for (int i(0); i < 4; ++i) {
81                 status[i].Render(screen, offset);
82         }
83 }
84
85
86 Resources &PartyMenu::Res() {
87         return *game->menuResources;
88 }
89
90 const Resources &PartyMenu::Res() const {
91         return *game->menuResources;
92 }
93
94 }