]> git.localhorst.tv Git - l2e.git/blob - src/battle/HeroTag.cpp
added Frame class for drawing bordered windows
[l2e.git] / src / battle / HeroTag.cpp
1 /*
2  * HeroTag.cpp
3  *
4  *  Created on: Aug 6, 2012
5  *      Author: holy
6  */
7
8 #include "HeroTag.h"
9
10 #include "Hero.h"
11 #include "../geometry/operators.h"
12 #include "../geometry/Vector.h"
13 #include "../graphics/Frame.h"
14 #include "../graphics/Sprite.h"
15
16 using geometry::Point;
17 using geometry::Vector;
18
19 namespace battle {
20
21 void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> position, bool active) const {
22         if (active) {
23                 activeFrame->Draw(screen, position, width, height);
24         } else {
25                 frame->Draw(screen, position, width, height);
26         }
27
28         Vector<int> heroOffset(
29                         (align == LEFT) ? 3 : width - hero->Sprite()->Width() - 3,
30                         height - hero->Sprite()->Height() - 3);
31         hero->Sprite()->Draw(screen, position + heroOffset, 0, hero->Health() > 0 ? 0 : 2);
32 }
33
34 }