From 8723daa89e877ac98e6012b0c37e3b4eb6131426 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 9 Aug 2012 14:55:37 +0200 Subject: [PATCH] added attack choice icons --- src/battle/HeroTag.cpp | 7 +++++++ src/battle/Resources.h | 2 ++ src/main.cpp | 3 +++ test-data/attack-choice-icons.png | Bin 0 -> 554 bytes 4 files changed, 12 insertions(+) create mode 100644 test-data/attack-choice-icons.png 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 0000000000000000000000000000000000000000..f349c27adc82f8d6d05d21c3ec602ecd0446e489 GIT binary patch literal 554 zcmV+_0@eMAP)uw7Y|2+c79epo43xi>s4uRtKRtb+iScIuu-lxT)Y!H%A4B zy0;LA=M8y*%_aO2Ru;3j=K%m})fxbxvRMHDIIE6~ z0z2ymoH@7)WMg0_MVrpfnfrsjd=^3g=uLY7fM&S^02tri003HtEdW6Gyc?TAIR%Ba z4FG`u)Y6o^JwK$@jGTgSdISI{majA=?y{Scg5XTOs5BPpmmIp0lo93>TE@CjV_vUL zw9NnxDGBrOgYiHyUJTT_UWGY7&_IkFQA`?+AxCO%>u2RzpqLn`#1H@`?~3tw*U^+v zO#Ew8j+9dKsr@6Dg`_iPK`sVAg@jk$NAmTp@;`I;*-*Nwzn zD#gEd+hP+6J3BFw4{&C4uFS#Do}|p2f~?8pPdZXUJrF4RQBTao9m!sBPLNaZ#oXLN z>|Ds#1b<{I3*L_M|ISHA`*x-^!6`bBjltwK{zl@Uv&(xTpU$(o(H{wUVibemRA)}= s|7e=uH#M!-k