]> git.localhorst.tv Git - l2e.git/blob - src/menu/ConfigMenu.cpp
added config menu dummy
[l2e.git] / src / menu / ConfigMenu.cpp
1 /*
2  * ConfigMenu.cpp
3  *
4  *  Created on: Nov 29, 2012
5  *      Author: holy
6  */
7
8 #include "ConfigMenu.h"
9
10 #include "PartyMenu.h"
11 #include "Resources.h"
12 #include "../common/GameConfig.h"
13 #include "../common/GameState.h"
14 #include "../graphics/Font.h"
15 #include "../graphics/Frame.h"
16
17 using app::Input;
18 using geometry::Vector;
19 using graphics::Font;
20 using graphics::Frame;
21
22 namespace menu {
23
24 ConfigMenu::ConfigMenu(PartyMenu *parent)
25 : parent(parent) {
26
27 }
28
29
30 void ConfigMenu::OnEnterState(SDL_Surface *) {
31
32 }
33
34 void ConfigMenu::OnExitState(SDL_Surface *) {
35
36 }
37
38 void ConfigMenu::OnResumeState(SDL_Surface *) {
39
40 }
41
42 void ConfigMenu::OnPauseState(SDL_Surface *) {
43
44 }
45
46
47 void ConfigMenu::OnResize(int width, int height) {
48
49 }
50
51
52 int ConfigMenu::Width() const {
53         return parent->Width();
54 }
55
56 int ConfigMenu::Height() const {
57         return parent->Height();
58 }
59
60
61 void ConfigMenu::HandleEvents(const Input &input) {
62         if (input.JustPressed(Input::ACTION_B)) {
63                 Ctrl().PopState();
64         }
65 }
66
67 void ConfigMenu::UpdateWorld(float deltaT) {
68
69 }
70
71 void ConfigMenu::Render(SDL_Surface *screen) {
72         const Font &font(*parent->Res().normalFont);
73         const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
74         const Vector<int> headlineOffset(
75                         font.CharWidth(), 2 * font.CharHeight() - font.CharHeight() / 8);
76         const Vector<int> menuOffset(
77                         font.CharWidth(), 5 * font.CharHeight() - font.CharHeight() / 8);
78
79         parent->RenderBackground(screen);
80         RenderHeadline(screen, offset + headlineOffset);
81         RenderMenu(screen, offset + menuOffset);
82 }
83
84 void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
85         const Font &font(*parent->Res().normalFont);
86         const Frame &frame(*parent->Res().statusFrame);
87         const Vector<int> textOffset(
88                         2 * font.CharWidth(), font.CharHeight());
89
90         frame.Draw(screen, offset, 10 * font.CharWidth(), 3 * font.CharHeight());
91         font.DrawString(parent->Res().mainMenuConfigText, screen, offset + textOffset, 6);
92 }
93
94 void ConfigMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
95         const Font &font(*parent->Res().normalFont);
96         const Frame &frame(*parent->Res().statusFrame);
97
98         frame.Draw(screen, offset, 30 * font.CharWidth(), 14 * font.CharHeight());
99 }
100
101 }