]> git.localhorst.tv Git - l2e.git/commitdiff
added attack choice icons
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 9 Aug 2012 12:55:37 +0000 (14:55 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 9 Aug 2012 12:55:37 +0000 (14:55 +0200)
src/battle/HeroTag.cpp
src/battle/Resources.h
src/main.cpp
test-data/attack-choice-icons.png [new file with mode: 0644]

index 531031f8e93868b2cb8143b40c650b6e424d6a0f..96dedd9269e836037804c4d1a0c822375ca20763 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "HeroTag.h"
 
+#include "AttackChoice.h"
 #include "Hero.h"
 #include "Resources.h"
 #include "../geometry/operators.h"
@@ -78,6 +79,12 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
        // name
        res->normalFont->DrawString(hero->Name(), screen, position + frameOffset + alignOffset, 5);
 
+       // attack icon
+       if (choice->GetType() != AttackChoice::UNDECIDED) {
+               Vector<int> attackIconOffset(labelX + res->heroTagLabels->Width(), frameOffset.Y() + 3 * res->heroTagFont->CharHeight());
+               res->attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, choice->GetType());
+       }
+
        // hero
        Vector<int> heroOffset(
                        (align == LEFT) ? yOffset : width - hero->Sprite()->Width() - yOffset,
index 0d18b9fbfbd8609127c25bd81f94adf45fdb5f0b..6cfc365add2a95d155273f0b6d1efb6133b8a6fc 100644 (file)
@@ -23,6 +23,7 @@ struct Resources {
 
        graphics::Sprite *moveIcons;
        graphics::Sprite *attackIcons;
+       graphics::Sprite *attackChoiceIcons;
 
        graphics::Frame *heroTagFrame;
        graphics::Frame *activeHeroTagFrame;
@@ -54,6 +55,7 @@ struct Resources {
        Resources()
        : moveIcons(0)
        , attackIcons(0)
+       , attackChoiceIcons(0)
 
        , heroTagFrame(0)
        , activeHeroTagFrame(0)
index 7dbeba0548ba481c81640b550fc9d4baaed94eea..e25eb7eae9e2e7d9396abae7ba7fb95144f5518e 100644 (file)
@@ -128,6 +128,9 @@ int main(int argc, char **argv) {
                SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
                Sprite attackIconsSprite(attackIconsImg, 32, 32);
                battleRes.attackIcons = &attackIconsSprite;
+               SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
+               Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
+               battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
                SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
                Sprite moveIconsSprite(moveIconsImg, 32, 32);
                battleRes.moveIcons = &moveIconsSprite;
diff --git a/test-data/attack-choice-icons.png b/test-data/attack-choice-icons.png
new file mode 100644 (file)
index 0000000..f349c27
Binary files /dev/null and b/test-data/attack-choice-icons.png differ