]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/AttackTypeMenu.cpp
removed stupid file headers that eclipse put in
[l2e.git] / src / battle / AttackTypeMenu.cpp
index 2a23a09bb7597415b1b44bc9f8080e8f5ba0255f..16bda253dd86df85206e00ba3531e8f68b354bba 100644 (file)
@@ -1,49 +1,24 @@
-/*
- * AttackTypeMenu.cpp
- *
- *  Created on: Aug 6, 2012
- *      Author: holy
- */
-
 #include "AttackTypeMenu.h"
 
-#include "../app/Input.h"
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Sprite.h"
 
-using app::Input;
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
 
-void AttackTypeMenu::ReadInput(const Input &input) {
-       if (input.IsDown(Input::PAD_UP)) {
-               selected = MAGIC;
-       } else if (input.IsDown(Input::PAD_RIGHT)) {
-               selected = DEFEND;
-       } else if (input.IsDown(Input::PAD_DOWN)) {
-               selected = IKARI;
-       } else if (input.IsDown(Input::PAD_LEFT)) {
-               selected = ITEM;
-       } else {
-               selected = SWORD;
-       }
-}
-
-void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Point<int> &center) {
-       Vector<int> swordOffset(icons->Width() / -2, icons->Height() / -2);
-       Vector<int> magicOffset(swordOffset.X(), swordOffset.Y() - icons->Height());
-       Vector<int> defendOffset(swordOffset.X() + icons->Width(), swordOffset.Y());
-       Vector<int> ikariOffset(swordOffset.X(), swordOffset.Y() + icons->Height());
-       Vector<int> itemOffset(swordOffset.X() - icons->Width(), swordOffset.Y());
-
-       icons->Draw(screen, center + swordOffset, SWORD, (selected == SWORD) ? 1 : 0);
-       icons->Draw(screen, center + magicOffset, MAGIC, (selected == MAGIC) ? 1 : 0);
-       icons->Draw(screen, center + defendOffset, DEFEND, (selected == DEFEND) ? 1 : 0);
-       icons->Draw(screen, center + ikariOffset, IKARI, (selected == IKARI) ? 1 : 0);
-       icons->Draw(screen, center + itemOffset, ITEM, (selected == ITEM) ? 1 : 0);
+void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Vector<int> &position) {
+       const Vector<int> &swordOffset(IconSize());
+       const Vector<int> magicOffset(IconWidth(), 0);
+       const Vector<int> defendOffset(2 * IconWidth(), IconHeight());
+       const Vector<int> ikariOffset(IconWidth(), 2 * IconHeight());
+       const Vector<int> itemOffset(0, IconHeight());
+
+       icons->Draw(screen, position + swordOffset, AttackChoice::SWORD, (selected == AttackChoice::SWORD) ? 1 : 0);
+       icons->Draw(screen, position + magicOffset, AttackChoice::MAGIC, (selected == AttackChoice::MAGIC) ? 1 : 0);
+       icons->Draw(screen, position + defendOffset, AttackChoice::DEFEND, (selected == AttackChoice::DEFEND) ? 1 : 0);
+       icons->Draw(screen, position + ikariOffset, AttackChoice::IKARI, (selected == AttackChoice::IKARI) ? 1 : 0);
+       icons->Draw(screen, position + itemOffset, AttackChoice::ITEM, (selected == AttackChoice::ITEM) ? 1 : 0);
 }
 
 }