+/*
+ * SelectSpell.cpp
+ *
+ * Created on: Aug 8, 2012
+ * Author: holy
+ */
+
+#include "SelectSpell.h"
+
+#include "SelectAttackType.h"
+#include "SelectMoveAction.h"
+#include "../BattleState.h"
+#include "../../app/Application.h"
+#include "../../app/Input.h"
+#include "../../geometry/operators.h"
+#include "../../geometry/Point.h"
+#include "../../graphics/Frame.h"
+
+using app::Application;
+using app::Input;
+using geometry::Point;
+using geometry::Vector;
+using graphics::Frame;
+
+namespace battle {
+
+void SelectSpell::EnterState(Application &c, SDL_Surface *screen) {
+ ctrl = &c;
+}
+
+void SelectSpell::ExitState(Application &c, SDL_Surface *screen) {
+ ctrl = 0;
+}
+
+void SelectSpell::ResumeState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+void SelectSpell::PauseState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+
+void SelectSpell::Resize(int width, int height) {
+
+}
+
+
+void SelectSpell::HandleInput(const Input &input) {
+ if (input.JustPressed(Input::ACTION_A)) {
+ // TODO: switch to target select
+ battle->NextHero();
+ ctrl->PopState();
+ }
+ if (input.JustPressed(Input::ACTION_B)) {
+ ctrl->PopState(); // return control to parent
+ }
+}
+
+void SelectSpell::UpdateWorld(float deltaT) {
+
+}
+
+void SelectSpell::Render(SDL_Surface *screen) {
+ parent->Render(screen);
+ const Frame &frame(battle->GetSelectFrame());
+ Point<int> position(frame.BorderWidth(), frame.BorderHeight());
+ Vector<int> offset(battle->CalculateScreenOffset(screen));
+ int width(battle->BackgroundWidth() - 2 * frame.BorderWidth());
+ // TODO: replace with font height
+ int height(frame.BorderHeight() * 13);
+ frame.Draw(screen, position + offset, width, height);
+}
+
+}