X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHeroTag.cpp;h=d67368ff9b98bf4d0d097e97c03633b0416993c1;hb=628b3a7276d0b330719e05504b23bafcf88f8fca;hp=2461e4de92363b2a19b0c020e1dd5eb1ec6c64c1;hpb=010a336797f1419945bed60560cc61fb492793f4;p=l2e.git diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 2461e4d..d67368f 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -7,11 +7,17 @@ #include "HeroTag.h" +#include "Hero.h" +#include "../geometry/operators.h" +#include "../geometry/Vector.h" +#include "../graphics/Sprite.h" + using geometry::Point; +using geometry::Vector; namespace battle { -void HeroTag::Render(SDL_Surface *screen, int width, int height, Point position) const { +void HeroTag::Render(SDL_Surface *screen, int width, int height, Point position, bool active) const { SDL_Rect destRect; destRect.x = position.X(); destRect.y = position.Y(); @@ -22,13 +28,18 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point posi destRect.y += 1; destRect.w -= 2; destRect.h -= 2; - SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF)); + SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 0xFF, active ? 0 : 0xFF, active ? 0 : 0xFF)); destRect.x += 1; destRect.y += 1; destRect.w -= 2; destRect.h -= 2; SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 0, 0, 0)); + + Vector heroOffset( + (align == LEFT) ? 3 : width - hero->Sprite()->Width() - 3, + height - hero->Sprite()->Height() - 3); + hero->Sprite()->Draw(screen, position + heroOffset); } }