<Unit filename="src\map\Trigger.cpp" />
<Unit filename="src\map\Trigger.h" />
<Unit filename="src\map\fwd.h" />
+ <Unit filename="src\menu\CapsuleMenu.cpp" />
+ <Unit filename="src\menu\CapsuleMenu.h" />
<Unit filename="src\menu\ChangeHero.cpp" />
<Unit filename="src\menu\ChangeHero.h" />
<Unit filename="src\menu\ConfigMenu.cpp" />
--- /dev/null
+#include "CapsuleMenu.h"
+
+#include "PartyMenu.h"
+#include "Resources.h"
+#include "../app/Application.h"
+#include "../app/Input.h"
+#include "../common/GameConfig.h"
+#include "../common/GameState.h"
+#include "../common/Stats.h"
+#include "../graphics/Font.h"
+#include "../graphics/Frame.h"
+#include "../graphics/Texture.h"
+
+using app::Input;
+using common::Capsule;
+using common::Stats;
+using geometry::Vector;
+using graphics::Font;
+using graphics::Frame;
+
+namespace menu {
+
+CapsuleMenu::CapsuleMenu(PartyMenu *parent)
+: parent(parent)
+, menu(*parent->Res().capsuleMenuProperties) {
+ menu.Add(parent->Res().capsuleFeedLabel, 0);
+ menu.Add(parent->Res().capsuleChangeLabel, 1);
+ menu.Add(parent->Res().capsuleNameLabel, 2);
+}
+
+
+void CapsuleMenu::OnEnterState(SDL_Surface *) {
+
+}
+
+void CapsuleMenu::OnExitState(SDL_Surface *) {
+
+}
+
+void CapsuleMenu::OnResumeState(SDL_Surface *) {
+
+}
+
+void CapsuleMenu::OnPauseState(SDL_Surface *) {
+
+}
+
+
+void CapsuleMenu::OnResize(int width, int height) {
+
+}
+
+
+void CapsuleMenu::HandleEvents(const Input &input) {
+ if (input.JustPressed(Input::ACTION_B)) {
+ Ctrl().PopState();
+ }
+}
+
+void CapsuleMenu::UpdateWorld(float deltaT) {
+
+}
+
+void CapsuleMenu::Render(SDL_Surface *screen) {
+ Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
+
+ RenderBackground(screen);
+}
+
+void CapsuleMenu::RenderBackground(SDL_Surface *screen) const {
+ parent->Res().capsulebg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
+}
+
+int CapsuleMenu::Width() const {
+ return parent->Width();
+}
+
+int CapsuleMenu::Height() const {
+ return parent->Height();
+}
+
+const Capsule &CapsuleMenu::GetCapsule() const {
+ return *parent->Game().state->capsule;
+}
+
+}
--- /dev/null
+#ifndef MENU_CAPSULEMENU_H_
+#define MENU_CAPSULEMENU_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../common/fwd.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Menu.h"
+
+namespace menu {
+
+class CapsuleMenu
+: public app::State {
+
+public:
+ explicit CapsuleMenu(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);
+
+ const common::Capsule &GetCapsule() const;
+
+ void RenderBackground(SDL_Surface *screen) const;
+
+private:
+ PartyMenu *parent;
+ graphics::Menu<int> menu;
+
+};
+
+}
+
+#endif /* MENU_CAPSULEMENU_H_ */
#include "PartyMenu.h"
+#include "CapsuleMenu.h"
#include "ChangeHero.h"
#include "ConfigMenu.h"
#include "EquipMenu.h"
mainMenu.Add(Res().mainMenuStatusText, 4);
mainMenu.Add(Res().mainMenuSpellText, 1);
mainMenu.Add(Res().mainMenuChangeText, 5);
- mainMenu.Add(Res().mainMenuCapsuleText, 2);
+ mainMenu.Add(Res().mainMenuCapsuleText, 2, game->state->capsule);
mainMenu.Add(Res().mainMenuConfigText, 6);
mainMenu.Add(Res().mainMenuEquipmentText, 3);
mainMenu.Add(Res().mainMenuScenarioText, 7);
Ctrl().PushState(new SelectHero(this, this, this, OnSpellSelect));
break;
case MENU_ITEM_CAPSULE:
+ if (game->state->capsule) {
+ Ctrl().PushState(new CapsuleMenu(this));
+ } else {
+ // noise and blur
+ }
break;
case MENU_ITEM_EQUIP:
Ctrl().PushState(new SelectHero(this, this, this, OnEquipSelect));
, scenarioMenuProperties(0)
, scenarioMenuHeadline(0)
+, capsulebg(0)
+
+, capsuleMenuProperties(0)
+
+, capsuleFeedLabel(0)
+, capsuleChangeLabel(0)
+, capsuleNameLabel(0)
+, capsuleClassLabel(0)
+, capsuleAlignmentLabel(0)
+, capsuleTribeLabel(0)
+, capsuleAttack1Label(0)
+, capsuleAttack2Label(0)
+, capsuleAttack3Label(0)
+
{ }
td.AddField("scenarioMenu", FieldDescription(((char *)&r.scenarioMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the scenario menu"));
td.AddField("scenarioMenuHeadline", FieldDescription(((char *)&r.scenarioMenuHeadline) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+ td.AddField("capsulebg", FieldDescription(((char *)&r.capsulebg) - ((char *)&r), Texture::TYPE_ID).SetReferenced().SetDescription("background texture for the capsule menus"));
+
+ td.AddField("capsuleMenu", FieldDescription(((char *)&r.capsuleMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the capsule main menu (the bottom bar)"));
+
+ td.AddField("capsuleFeedLabel", FieldDescription(((char *)&r.capsuleFeedLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleChangeLabel", FieldDescription(((char *)&r.capsuleChangeLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleNameLabel", FieldDescription(((char *)&r.capsuleNameLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleClassLabel", FieldDescription(((char *)&r.capsuleClassLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleAlignmentLabel", FieldDescription(((char *)&r.capsuleAlignmentLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleTribeLabel", FieldDescription(((char *)&r.capsuleTribeLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleAttack1Label", FieldDescription(((char *)&r.capsuleAttack1Label) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleAttack2Label", FieldDescription(((char *)&r.capsuleAttack2Label) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+ td.AddField("capsuleAttack3Label", FieldDescription(((char *)&r.capsuleAttack3Label) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
}
void Resources::Construct(void *data) {
graphics::MenuProperties *scenarioMenuProperties;
const char *scenarioMenuHeadline;
+ graphics::Texture *capsulebg;
+
+ graphics::MenuProperties *capsuleMenuProperties;
+
+ const char *capsuleFeedLabel;
+ const char *capsuleChangeLabel;
+ const char *capsuleNameLabel;
+ const char *capsuleClassLabel;
+ const char *capsuleAlignmentLabel;
+ const char *capsuleTribeLabel;
+ const char *capsuleAttack1Label;
+ const char *capsuleAttack2Label;
+ const char *capsuleAttack3Label;
+
Resources();
static void CreateTypeDescription();
namespace menu {
+class CapsuleMenu;
class ChangeHero;
class ConfigMenu;
class EquipMenu;
colGap: 32,
cursor: menuCursor,
font: menuFont,
+ disabledFont: menuInactiveFont,
wrapX: true,
wrapY: true
},
cursor: menuCursor,
font: menuFont
},
- scenarioMenuHeadline: "SCENARIO ITEM"
+ scenarioMenuHeadline: "SCENARIO ITEM",
+ capsulebg: Texture {
+ image: :"capsulebg.png",
+ size: <64, 64>
+ },
+ capsuleMenu: MenuProperties {
+ cols: 3,
+ rows: 1
+ },
+ capsuleFeedLabel: "FEED",
+ capsuleChangeLabel: "CHANGE",
+ capsuleNameLabel: "NAME",
+ capsuleClassLabel: "CLASS",
+ capsuleAlignmentLabel: "ALI.",
+ capsuleTribeLabel: "TRIBE",
+ capsuleAttack1Label: "SP.1",
+ capsuleAttack2Label: "SP.2",
+ capsuleAttack3Label: "SP.3"
}