<Unit filename="src\map\Trigger.cpp" />
<Unit filename="src\map\Trigger.h" />
<Unit filename="src\map\fwd.h" />
+ <Unit filename="src\menu\CapsuleChangeMenu.cpp" />
+ <Unit filename="src\menu\CapsuleChangeMenu.h" />
+ <Unit filename="src\menu\CapsuleFeedMenu.cpp" />
+ <Unit filename="src\menu\CapsuleFeedMenu.h" />
<Unit filename="src\menu\CapsuleMenu.cpp" />
<Unit filename="src\menu\CapsuleMenu.h" />
<Unit filename="src\menu\ChangeHero.cpp" />
--- /dev/null
+#include "CapsuleChangeMenu.h"
+
+#include "CapsuleMenu.h"
+#include "Resources.h"
+#include "../app/Application.h"
+#include "../app/Input.h"
+#include "../common/Inventory.h"
+#include "../common/Item.h"
+#include "../common/GameConfig.h"
+#include "../common/GameState.h"
+#include "../graphics/Font.h"
+#include "../graphics/Frame.h"
+
+using app::Input;
+using common::Capsule;
+using common::Inventory;
+using common::Item;
+using geometry::Vector;
+using graphics::Font;
+using graphics::Frame;
+
+namespace menu {
+
+CapsuleChangeMenu::CapsuleChangeMenu(CapsuleMenu *parent)
+: parent(parent) {
+
+}
+
+
+void CapsuleChangeMenu::OnEnterState(SDL_Surface *) {
+
+}
+
+void CapsuleChangeMenu::OnExitState(SDL_Surface *) {
+
+}
+
+void CapsuleChangeMenu::OnResumeState(SDL_Surface *) {
+
+}
+
+void CapsuleChangeMenu::OnPauseState(SDL_Surface *) {
+
+}
+
+
+void CapsuleChangeMenu::OnResize(int width, int height) {
+
+}
+
+
+void CapsuleChangeMenu::HandleEvents(const Input &input) {
+ if (input.JustPressed(Input::ACTION_B)) {
+ Ctrl().PopState();
+ }
+}
+
+void CapsuleChangeMenu::UpdateWorld(float deltaT) {
+
+}
+
+void CapsuleChangeMenu::Render(SDL_Surface *screen) {
+ const Font &font(*parent->Res().statusFont);
+ const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
+ const Vector<int> capsuleOffset(
+ 6 * font.CharWidth(),
+ 12 * font.CharHeight());
+ const Vector<int> infoOffset(
+ 12 * font.CharWidth(),
+ 2 * font.CharHeight() - font.CharHeight() / 8);
+ // TODO: wheel offset: top left, center, or center bottom?
+ const Vector<int> wheelOffset;
+ const Vector<int> menuOffset(
+ font.CharWidth(),
+ 24 * font.CharHeight() - font.CharHeight() / 8);
+
+ parent->RenderBackground(screen);
+ parent->RenderCapsule(screen, offset + capsuleOffset);
+ parent->RenderInfo(screen, offset + infoOffset);
+ parent->RenderWheel(screen, offset + wheelOffset);
+ parent->RenderMenu(screen, offset + menuOffset);
+}
+
+
+int CapsuleChangeMenu::Width() const {
+ return parent->Width();
+}
+
+int CapsuleChangeMenu::Height() const {
+ return parent->Height();
+}
+
+const Capsule &CapsuleChangeMenu::GetCapsule() const {
+ return parent->GetCapsule();
+}
+
+}
--- /dev/null
+#ifndef MENU_CAPSULECHANGEMENU_H_
+#define MENU_CAPSULECHANGEMENU_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../common/fwd.h"
+#include "../geometry/Vector.h"
+
+namespace menu {
+
+class CapsuleMenu;
+
+class CapsuleChangeMenu
+: public app::State {
+
+public:
+ explicit CapsuleChangeMenu(CapsuleMenu *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 LoadInventory();
+
+private:
+ CapsuleMenu *parent;
+
+};
+
+}
+
+#endif /* MENU_CAPSULECHANGEMENU_H_ */