]> git.localhorst.tv Git - l2e.git/blob - src/menu/CapsuleChangeMenu.cpp
added capsule change menu stub
[l2e.git] / src / menu / CapsuleChangeMenu.cpp
1 #include "CapsuleChangeMenu.h"
2
3 #include "CapsuleMenu.h"
4 #include "Resources.h"
5 #include "../app/Application.h"
6 #include "../app/Input.h"
7 #include "../common/Inventory.h"
8 #include "../common/Item.h"
9 #include "../common/GameConfig.h"
10 #include "../common/GameState.h"
11 #include "../graphics/Font.h"
12 #include "../graphics/Frame.h"
13
14 using app::Input;
15 using common::Capsule;
16 using common::Inventory;
17 using common::Item;
18 using geometry::Vector;
19 using graphics::Font;
20 using graphics::Frame;
21
22 namespace menu {
23
24 CapsuleChangeMenu::CapsuleChangeMenu(CapsuleMenu *parent)
25 : parent(parent) {
26
27 }
28
29
30 void CapsuleChangeMenu::OnEnterState(SDL_Surface *) {
31
32 }
33
34 void CapsuleChangeMenu::OnExitState(SDL_Surface *) {
35
36 }
37
38 void CapsuleChangeMenu::OnResumeState(SDL_Surface *) {
39
40 }
41
42 void CapsuleChangeMenu::OnPauseState(SDL_Surface *) {
43
44 }
45
46
47 void CapsuleChangeMenu::OnResize(int width, int height) {
48
49 }
50
51
52 void CapsuleChangeMenu::HandleEvents(const Input &input) {
53         if (input.JustPressed(Input::ACTION_B)) {
54                 Ctrl().PopState();
55         }
56 }
57
58 void CapsuleChangeMenu::UpdateWorld(float deltaT) {
59
60 }
61
62 void CapsuleChangeMenu::Render(SDL_Surface *screen) {
63         const Font &font(*parent->Res().statusFont);
64         const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
65         const Vector<int> capsuleOffset(
66                         6 * font.CharWidth(),
67                         12 * font.CharHeight());
68         const Vector<int> infoOffset(
69                         12 * font.CharWidth(),
70                         2 * font.CharHeight() - font.CharHeight() / 8);
71         // TODO: wheel offset: top left, center, or center bottom?
72         const Vector<int> wheelOffset;
73         const Vector<int> menuOffset(
74                                 font.CharWidth(),
75                                 24 * font.CharHeight() - font.CharHeight() / 8);
76
77         parent->RenderBackground(screen);
78         parent->RenderCapsule(screen, offset + capsuleOffset);
79         parent->RenderInfo(screen, offset + infoOffset);
80         parent->RenderWheel(screen, offset + wheelOffset);
81         parent->RenderMenu(screen, offset + menuOffset);
82 }
83
84
85 int CapsuleChangeMenu::Width() const {
86         return parent->Width();
87 }
88
89 int CapsuleChangeMenu::Height() const {
90         return parent->Height();
91 }
92
93 const Capsule &CapsuleChangeMenu::GetCapsule() const {
94         return parent->GetCapsule();
95 }
96
97 }