]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectMoveAction.cpp
cached some of the battle coordinates
[l2e.git] / src / battle / states / SelectMoveAction.cpp
index 52b670b5d941d019b1132884a40af89557c83763..c8405da7968340d01aa58f5c6c4ee7ee48f7697b 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * SelectMoveAction.cpp
- *
- *  Created on: Aug 7, 2012
- *      Author: holy
- */
-
 #include "SelectMoveAction.h"
 
 #include "RunState.h"
 #include "../MoveMenu.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
+#include "../../math/Vector.h"
 
 using app::Application;
 using app::Input;
-using geometry::Vector;
+using math::Vector;
 
 namespace battle {
 
 void SelectMoveAction::OnEnterState(SDL_Surface *screen) {
-
+       OnResize(screen->w, screen->h);
 }
 
 void SelectMoveAction::OnExitState(SDL_Surface *screen) {
@@ -39,7 +33,9 @@ void SelectMoveAction::OnPauseState(SDL_Surface *screen) {
 
 
 void SelectMoveAction::OnResize(int width, int height) {
-
+       position = battle->ScreenOffset() + Vector<int>(
+                       (battle->Width() - battle->GetMoveMenu().Width()) / 2,
+                       battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2);
 }
 
 
@@ -68,23 +64,19 @@ void SelectMoveAction::HandleEvents(const Input &input) {
        }
 }
 
-void SelectMoveAction::UpdateWorld(float deltaT) {
+void SelectMoveAction::UpdateWorld(Uint32 deltaT) {
 
 }
 
 void SelectMoveAction::Render(SDL_Surface *screen) {
-       Vector<int> offset(battle->CalculateScreenOffset(screen));
-       battle->RenderBackground(screen, offset);
-       battle->RenderMonsters(screen, offset);
-       battle->RenderHeroTags(screen, offset);
-       RenderMenu(screen, offset);
+       battle->RenderBackground(screen);
+       battle->RenderMonsters(screen);
+       battle->RenderHeroTags(screen);
+       RenderMenu(screen);
 }
 
-void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
-       Vector<int> position(
-                       (battle->Width() - battle->GetMoveMenu().Width()) / 2,
-                       battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2);
-       battle->GetMoveMenu().Render(screen, position + offset);
+void SelectMoveAction::RenderMenu(SDL_Surface *screen) {
+       battle->GetMoveMenu().Render(screen, position);
 }
 
 }