From: Daniel Karbach Date: Thu, 9 Aug 2012 12:55:37 +0000 (+0200) Subject: added attack choice icons X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=8723daa89e877ac98e6012b0c37e3b4eb6131426;p=l2e.git added attack choice icons --- diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 531031f..96dedd9 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -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 posi // name res->normalFont->DrawString(hero->Name(), screen, position + frameOffset + alignOffset, 5); + // attack icon + if (choice->GetType() != AttackChoice::UNDECIDED) { + Vector attackIconOffset(labelX + res->heroTagLabels->Width(), frameOffset.Y() + 3 * res->heroTagFont->CharHeight()); + res->attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, choice->GetType()); + } + // hero Vector heroOffset( (align == LEFT) ? yOffset : width - hero->Sprite()->Width() - yOffset, diff --git a/src/battle/Resources.h b/src/battle/Resources.h index 0d18b9f..6cfc365 100644 --- a/src/battle/Resources.h +++ b/src/battle/Resources.h @@ -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) diff --git a/src/main.cpp b/src/main.cpp index 7dbeba0..e25eb7e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 index 0000000..f349c27 Binary files /dev/null and b/test-data/attack-choice-icons.png differ