+/*
+ * RunState.cpp
+ *
+ * Created on: Aug 10, 2012
+ * Author: holy
+ */
+
+#include "RunState.h"
+
+#include "../BattleState.h"
+#include "../../app/Application.h"
+#include "../../app/Input.h"
+#include "../../geometry/operators.h"
+#include "../../geometry/Point.h"
+
+using app::Application;
+using app::Input;
+using geometry::Point;
+using geometry::Vector;
+
+namespace battle {
+
+void RunState::EnterState(Application &c, SDL_Surface *screen) {
+ ctrl = &c;
+ // TODO: push battle animation if enemy is faster
+}
+
+void RunState::ExitState(Application &c, SDL_Surface *screen) {
+ ctrl = 0;
+}
+
+void RunState::ResumeState(Application &ctrl, SDL_Surface *screen) {
+ timer = GraphicsTimers().StartCountdown(2500);
+}
+
+void RunState::PauseState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+
+void RunState::Resize(int width, int height) {
+
+}
+
+
+void RunState::HandleEvents(const Input &input) {
+ if (timer.Finished()) {
+ ctrl->PopState(); // pop self
+ ctrl->PopState(); // pop battle
+ }
+}
+
+
+void RunState::UpdateWorld(float deltaT) {
+
+}
+
+void RunState::Render(SDL_Surface *screen) {
+ Vector<int> offset(battle->CalculateScreenOffset(screen));
+ battle->RenderBackground(screen, offset);
+ battle->RenderMonsters(screen, offset);
+ battle->RenderHeroes(screen, offset);
+ // render small tags
+}
+
+}