--- /dev/null
+/*
+ * ConfigMenu.cpp
+ *
+ * Created on: Nov 29, 2012
+ * Author: holy
+ */
+
+#include "ConfigMenu.h"
+
+#include "PartyMenu.h"
+#include "Resources.h"
+#include "../common/GameConfig.h"
+#include "../common/GameState.h"
+#include "../graphics/Font.h"
+#include "../graphics/Frame.h"
+
+using app::Input;
+using geometry::Vector;
+using graphics::Font;
+using graphics::Frame;
+
+namespace menu {
+
+ConfigMenu::ConfigMenu(PartyMenu *parent)
+: parent(parent) {
+
+}
+
+
+void ConfigMenu::OnEnterState(SDL_Surface *) {
+
+}
+
+void ConfigMenu::OnExitState(SDL_Surface *) {
+
+}
+
+void ConfigMenu::OnResumeState(SDL_Surface *) {
+
+}
+
+void ConfigMenu::OnPauseState(SDL_Surface *) {
+
+}
+
+
+void ConfigMenu::OnResize(int width, int height) {
+
+}
+
+
+int ConfigMenu::Width() const {
+ return parent->Width();
+}
+
+int ConfigMenu::Height() const {
+ return parent->Height();
+}
+
+
+void ConfigMenu::HandleEvents(const Input &input) {
+ if (input.JustPressed(Input::ACTION_B)) {
+ Ctrl().PopState();
+ }
+}
+
+void ConfigMenu::UpdateWorld(float deltaT) {
+
+}
+
+void ConfigMenu::Render(SDL_Surface *screen) {
+ const Font &font(*parent->Res().normalFont);
+ const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
+ const Vector<int> headlineOffset(
+ font.CharWidth(), 2 * font.CharHeight() - font.CharHeight() / 8);
+ const Vector<int> menuOffset(
+ font.CharWidth(), 5 * font.CharHeight() - font.CharHeight() / 8);
+
+ parent->RenderBackground(screen);
+ RenderHeadline(screen, offset + headlineOffset);
+ RenderMenu(screen, offset + menuOffset);
+}
+
+void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+ const Font &font(*parent->Res().normalFont);
+ const Frame &frame(*parent->Res().statusFrame);
+ const Vector<int> textOffset(
+ 2 * font.CharWidth(), font.CharHeight());
+
+ frame.Draw(screen, offset, 10 * font.CharWidth(), 3 * font.CharHeight());
+ font.DrawString(parent->Res().mainMenuConfigText, screen, offset + textOffset, 6);
+}
+
+void ConfigMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+ const Font &font(*parent->Res().normalFont);
+ const Frame &frame(*parent->Res().statusFrame);
+
+ frame.Draw(screen, offset, 30 * font.CharWidth(), 14 * font.CharHeight());
+}
+
+}
--- /dev/null
+/*
+ * ConfigMenu.h
+ *
+ * Created on: Nov 29, 2012
+ * Author: holy
+ */
+
+#ifndef MENU_CONFIGMENU_H_
+#define MENU_CONFIGMENU_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../geometry/Vector.h"
+
+namespace menu {
+
+class ConfigMenu
+: public app::State {
+
+public:
+ explicit ConfigMenu(PartyMenu *parent);
+
+public:
+ virtual void HandleEvents(const app::Input &);
+ virtual void UpdateWorld(float deltaT);
+ virtual void Render(SDL_Surface *);
+
+public:
+ int Width() const;
+ int Height() const;
+
+private:
+ virtual void OnEnterState(SDL_Surface *screen);
+ virtual void OnExitState(SDL_Surface *screen);
+ virtual void OnResumeState(SDL_Surface *screen);
+ virtual void OnPauseState(SDL_Surface *screen);
+
+ virtual void OnResize(int width, int height);
+
+ void RenderHeadline(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+ void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+
+private:
+ PartyMenu *parent;
+
+};
+
+}
+
+#endif /* MENU_CONFIGMENU_H_ */