]> git.localhorst.tv Git - l2e.git/commitdiff
better positioning of hero tags
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 7 Aug 2012 19:25:50 +0000 (21:25 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 7 Aug 2012 19:25:50 +0000 (21:25 +0200)
src/battle/BattleState.cpp
src/battle/HeroTag.cpp
src/main.cpp
test-data/battle-bg.png
test-data/hero.png

index 2b46cacb879f405eb5d1118dc94d62d709fc8a59..6cb3b328c156fb75d32318ed11011ee11c4e044d 100644 (file)
@@ -112,14 +112,14 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector<int> &offset) {
 }
 
 void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector<int> &offset) {
-       int margin(attackTypeMenu.Height() / 48);
+       int margin(attackTypeMenu.Height() * 3 / 48);
        int tagHeight(attackTypeMenu.Height() - 2 * margin);
        int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2 - 2 * margin);
        int xOffset((BackgroundWidth() - 2 * tagWidth - 2 * margin) / 2);
 
        Point<int> tagPosition[4];
-       tagPosition[0] = Point<int>(xOffset, BackgroundHeight() - 2 * tagHeight - margin);
-       tagPosition[1] = Point<int>(xOffset + tagWidth + 2 * margin, BackgroundHeight() - 2 * tagHeight - margin);
+       tagPosition[0] = Point<int>(xOffset, BackgroundHeight() - 2 * tagHeight - 3 * margin);
+       tagPosition[1] = Point<int>(xOffset + tagWidth + 2 * margin, BackgroundHeight() - 2 * tagHeight - 3 * margin);
        tagPosition[2] = Point<int>(xOffset, BackgroundHeight() - tagHeight - margin);
        tagPosition[3] = Point<int>(xOffset + tagWidth + 2 * margin, BackgroundHeight() - tagHeight - margin);
 
index 0b7aa2700b83f33308bc05644100b0f101c5323c..87f35dd171813f4db3e093c77b5d99f3ed0ab8e7 100644 (file)
@@ -25,9 +25,11 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
                frame->Draw(screen, position, width, height);
        }
 
+       int verticalHeroOffset((height - hero->Sprite()->Height()) / 2);
+
        Vector<int> heroOffset(
-                       (align == LEFT) ? 3 : width - hero->Sprite()->Width() - 3,
-                       height - hero->Sprite()->Height() - 3);
+                       (align == LEFT) ? verticalHeroOffset : width - hero->Sprite()->Width() - verticalHeroOffset,
+                       verticalHeroOffset);
        hero->Sprite()->Draw(screen, position + heroOffset, 0, hero->Health() > 0 ? 0 : 2);
 }
 
index 767464bfe5f7be7b33799aa87cf4b38cc26c1f88..f12b2750b9a833dbca3fc25d8faa8d48f65330dd 100644 (file)
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {
                monster.SetSprite(&dummySprite);
 
                SDL_Surface *heroImg(IMG_Load("test-data/hero.png"));
-               Sprite heroSprite(heroImg, 96, 96);
+               Sprite heroSprite(heroImg, 64, 64);
                Hero hero;
                hero.SetName("Name");
                hero.SetLevel(34);
index 4c8a0af8c950c94171545143cd2db725ecacbd1d..b62ab74798ce01f3d471579dc157179595f6817e 100644 (file)
Binary files a/test-data/battle-bg.png and b/test-data/battle-bg.png differ
index c61b2179b8d08db3e93ebb50ea939d1ddc042c42..ce5df5c738d26c9e653e4b84f8453e488f34c31f 100644 (file)
Binary files a/test-data/hero.png and b/test-data/hero.png differ