+/*
+ * 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());
+}
+
+}