1 #include "CapsuleMenu.h"
5 #include "../app/Application.h"
6 #include "../app/Input.h"
7 #include "../common/GameConfig.h"
8 #include "../common/GameState.h"
9 #include "../common/Stats.h"
10 #include "../graphics/Font.h"
11 #include "../graphics/Frame.h"
12 #include "../graphics/Texture.h"
15 using common::Capsule;
17 using geometry::Vector;
19 using graphics::Frame;
23 CapsuleMenu::CapsuleMenu(PartyMenu *parent)
25 , menu(*parent->Res().capsuleMenuProperties) {
26 menu.Add(parent->Res().capsuleFeedLabel, 0);
27 menu.Add(parent->Res().capsuleChangeLabel, 1);
28 menu.Add(parent->Res().capsuleNameLabel, 2);
32 void CapsuleMenu::OnEnterState(SDL_Surface *) {
36 void CapsuleMenu::OnExitState(SDL_Surface *) {
40 void CapsuleMenu::OnResumeState(SDL_Surface *) {
44 void CapsuleMenu::OnPauseState(SDL_Surface *) {
49 void CapsuleMenu::OnResize(int width, int height) {
54 void CapsuleMenu::HandleEvents(const Input &input) {
55 if (input.JustPressed(Input::ACTION_B)) {
60 void CapsuleMenu::UpdateWorld(float deltaT) {
64 void CapsuleMenu::Render(SDL_Surface *screen) {
65 Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
67 RenderBackground(screen);
70 void CapsuleMenu::RenderBackground(SDL_Surface *screen) const {
71 parent->Res().capsulebg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
74 int CapsuleMenu::Width() const {
75 return parent->Width();
78 int CapsuleMenu::Height() const {
79 return parent->Height();
82 const Capsule &CapsuleMenu::GetCapsule() const {
83 return *parent->Game().state->capsule;