X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHeroTag.cpp;h=6dc5e86fa11d261063def6720f0bd6b82ed73e59;hb=3d69f521b593457304b282e5f23e36ab165288b6;hp=d50b4132d85860f7556041794eac260793c92480;hpb=04b582180c8f86f50f08f5141a2514a1fcda3e01;p=l2e.git diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index d50b413..6dc5e86 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -1,25 +1,16 @@ -/* - * HeroTag.cpp - * - * Created on: Aug 6, 2012 - * Author: holy - */ - #include "HeroTag.h" #include "AttackChoice.h" #include "BattleState.h" #include "Hero.h" #include "Resources.h" -#include "../geometry/operators.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Gauge.h" #include "../graphics/Sprite.h" -using geometry::Point; -using geometry::Vector; +using math::Vector; using graphics::Frame; namespace battle { @@ -28,12 +19,12 @@ const graphics::Sprite *HeroTag::HeroSprite() const { return battle->HeroAt(index).Sprite(); } -void HeroTag::Render(SDL_Surface *screen, int width, int height, Point position, bool active) const { +void HeroTag::Render(SDL_Surface *screen, int width, int height, const Vector &position, bool active) const { const Resources &r(battle->Res()); // frame const Frame *frame(active ? r.activeHeroTagFrame : r.heroTagFrame); - Vector frameOffset(frame->BorderWidth(), frame->BorderHeight()); + Vector frameOffset(frame->BorderSize()); Vector alignOffset((index % 2) ? 4 * r.heroTagFont->CharWidth() : 0, 0); frame->Draw(screen, position, width, height); @@ -87,19 +78,19 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point posi r.normalFont->DrawString(hero.Name(), screen, position + frameOffset + alignOffset, 5); // attack icon - if (battle->AttackChoiceAt(index).GetType() != AttackChoice::UNDECIDED) { + if (battle->HeroAt(index).GetAttackChoice().GetType() != AttackChoice::UNDECIDED) { Vector attackIconOffset(labelX + r.heroTagLabels->Width(), frameOffset.Y() + 3 * r.heroTagFont->CharHeight()); - r.attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, battle->AttackChoiceAt(index).GetType()); + r.attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, battle->HeroAt(index).GetAttackChoice().GetType()); } // hero - HeroSprite()->Draw(screen, position + HeroOffset(), 0, battle->HeroAt(index).Health() > 0 ? 0 : 2); + HeroSprite()->DrawCenter(screen, position + HeroOffset(), 0, battle->HeroAt(index).Health() > 0 ? 0 : 2); } Vector HeroTag::HeroOffset() const { return Vector( - (index % 2) ? battle->Res().normalFont->CharWidth() : 10 * battle->Res().normalFont->CharWidth(), - battle->Res().normalFont->CharWidth()); + ((index % 2) ? battle->Res().normalFont->CharWidth() : 10 * battle->Res().normalFont->CharWidth()) + HeroSprite()->Width() / 2, + battle->Res().normalFont->CharWidth() + HeroSprite()->Height() / 2); } }