]> git.localhorst.tv Git - l2e.git/blob - src/battle/HeroTag.cpp
added battle move menu
[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/Sprite.h"
14
15 using geometry::Point;
16 using geometry::Vector;
17
18 namespace battle {
19
20 void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> position, bool active) const {
21         SDL_Rect destRect;
22         destRect.x = position.X();
23         destRect.y = position.Y();
24         destRect.w = width;
25         destRect.h = height;
26
27         destRect.x += 1;
28         destRect.y += 1;
29         destRect.w -= 2;
30         destRect.h -= 2;
31         SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 0xFF, active ? 0 : 0xFF, active ? 0 : 0xFF));
32
33         destRect.x += 1;
34         destRect.y += 1;
35         destRect.w -= 2;
36         destRect.h -= 2;
37         SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 0, 0, 0));
38
39         Vector<int> heroOffset(
40                         (align == LEFT) ? 3 : width - hero->Sprite()->Width() - 3,
41                         height - hero->Sprite()->Height() - 3);
42         hero->Sprite()->Draw(screen, position + heroOffset);
43 }
44
45 }