]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/CapsuleMenu.cpp
switched geometric scalars from floating to fixed
[l2e.git] / src / menu / CapsuleMenu.cpp
index 6d0fba8f0a68a3b518428d557e3df494e8f29379..e50215ce34979cc628853a9225d55d31c160f637 100644 (file)
@@ -1,6 +1,8 @@
 #include "CapsuleMenu.h"
 
+#include "CapsuleChangeMenu.h"
 #include "CapsuleFeedMenu.h"
+#include "CapsuleNameMenu.h"
 #include "PartyMenu.h"
 #include "Resources.h"
 #include "../app/Application.h"
@@ -16,7 +18,7 @@
 using app::Input;
 using common::Capsule;
 using common::Stats;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 
@@ -68,11 +70,11 @@ void CapsuleMenu::HandleEvents(const Input &input) {
                                menu.SetSelected();
                                break;
                        case CHOICE_CHANGE:
-                               // push change menu
+                               Ctrl().PushState(new CapsuleChangeMenu(this));
                                menu.SetSelected();
                                break;
                        case CHOICE_NAME:
-                               // push name menu
+                               Ctrl().PushState(new CapsuleNameMenu(this));
                                menu.SetSelected();
                                break;
                }
@@ -81,7 +83,7 @@ void CapsuleMenu::HandleEvents(const Input &input) {
        }
 }
 
-void CapsuleMenu::UpdateWorld(float deltaT) {
+void CapsuleMenu::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -95,7 +97,9 @@ void CapsuleMenu::Render(SDL_Surface *screen) {
                        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> wheelOffset(
+                       6 * font.CharWidth(),
+                       19 * font.CharHeight() - font.CharHeight() / 8);
        const Vector<int> statsOffset(
                        12 * font.CharWidth(),
                        15 * font.CharHeight() - font.CharHeight() / 8);
@@ -175,7 +179,8 @@ void CapsuleMenu::RenderInfo(SDL_Surface *screen, const Vector<int> &offset) con
 }
 
 void CapsuleMenu::RenderWheel(SDL_Surface *screen, const Vector<int> &offset) const {
-       // later
+       Res().capsuleAlignmentWheel->DrawCenter(screen, offset);
+       Res().capsuleAlignmentCursor->DrawCenter(screen, offset + Game().state->GetCapsule().AlignmentOffset());
 }
 
 void CapsuleMenu::RenderStats(SDL_Surface *screen, const Vector<int> &offset) const {
@@ -215,7 +220,7 @@ void CapsuleMenu::RenderStats(SDL_Surface *screen, const Vector<int> &offset) co
        font.DrawNumberRight(capsule.NextLevel(), screen, lineHead);
 }
 
-void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const {
+void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const math::Vector<int> &offset, const char *name, int value) const {
        const Font &font(*Res().statusFont);
        const Vector<int> numberOffset(4 * font.CharWidth(), 0);
 
@@ -258,8 +263,12 @@ int CapsuleMenu::Height() const {
        return parent->Height();
 }
 
+Capsule &CapsuleMenu::GetCapsule() {
+       return Game().state->GetCapsule();
+}
+
 const Capsule &CapsuleMenu::GetCapsule() const {
-       return *Game().state->capsule;
+       return Game().state->GetCapsule();
 }
 
 }