X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FCapsuleMenu.cpp;h=e2a983ea81b3b5b2a5d1d2d8b393bd55c079fa76;hb=HEAD;hp=6d0fba8f0a68a3b518428d557e3df494e8f29379;hpb=7a14d357d9d05c2bac1efcdcf57365a4ce13729a;p=l2e.git diff --git a/src/menu/CapsuleMenu.cpp b/src/menu/CapsuleMenu.cpp index 6d0fba8..e2a983e 100644 --- a/src/menu/CapsuleMenu.cpp +++ b/src/menu/CapsuleMenu.cpp @@ -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" @@ -12,11 +14,12 @@ #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; @@ -32,7 +35,7 @@ CapsuleMenu::CapsuleMenu(PartyMenu *parent) void CapsuleMenu::OnEnterState(SDL_Surface *) { - + menu.StartAnimation(Ctrl()); } void CapsuleMenu::OnExitState(SDL_Surface *) { @@ -68,11 +71,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 +84,7 @@ void CapsuleMenu::HandleEvents(const Input &input) { } } -void CapsuleMenu::UpdateWorld(float deltaT) { +void CapsuleMenu::UpdateWorld(Uint32 deltaT) { } @@ -95,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 wheelOffset; + const Vector wheelOffset( + 6 * font.CharWidth(), + 19 * font.CharHeight() - font.CharHeight() / 8); const Vector statsOffset( 12 * font.CharWidth(), 15 * font.CharHeight() - font.CharHeight() / 8); @@ -112,7 +117,7 @@ void CapsuleMenu::Render(SDL_Surface *screen) { } void CapsuleMenu::RenderBackground(SDL_Surface *screen) const { - Res().capsulebg->Render(screen, Vector(), Vector(screen->w, screen->h)); + Res().capsulebg->Draw(screen, Vector(), Vector(screen->w, screen->h)); } void CapsuleMenu::RenderCapsule(SDL_Surface *screen, const Vector &offset) const { @@ -175,7 +180,8 @@ void CapsuleMenu::RenderInfo(SDL_Surface *screen, const Vector &offset) con } void CapsuleMenu::RenderWheel(SDL_Surface *screen, const Vector &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 &offset) const { @@ -215,7 +221,7 @@ void CapsuleMenu::RenderStats(SDL_Surface *screen, const Vector &offset) co font.DrawNumberRight(capsule.NextLevel(), screen, lineHead); } -void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector &offset, const char *name, int value) const { +void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const math::Vector &offset, const char *name, int value) const { const Font &font(*Res().statusFont); const Vector numberOffset(4 * font.CharWidth(), 0); @@ -258,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(); } }