]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/CapsuleMenu.cpp
added menu cursor animations
[l2e.git] / src / menu / CapsuleMenu.cpp
index ab32a1bcb2260b3b2a51d57d6cda58958ed23362..b45a204a9366514af10046ac8127ffbd8f83d1d4 100644 (file)
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
 #include "../graphics/Texture.h"
+#include "../math/Vector.h"
 
 using app::Input;
 using common::Capsule;
 using common::Stats;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 
@@ -34,7 +35,7 @@ CapsuleMenu::CapsuleMenu(PartyMenu *parent)
 
 
 void CapsuleMenu::OnEnterState(SDL_Surface *) {
-
+       menu.StartAnimation(Ctrl());
 }
 
 void CapsuleMenu::OnExitState(SDL_Surface *) {
@@ -83,7 +84,7 @@ void CapsuleMenu::HandleEvents(const Input &input) {
        }
 }
 
-void CapsuleMenu::UpdateWorld(float deltaT) {
+void CapsuleMenu::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -97,7 +98,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);
@@ -177,7 +180,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 {
@@ -217,7 +221,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);
 
@@ -260,8 +264,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();
 }
 
 }