From: Daniel Karbach Date: Tue, 7 Aug 2012 18:55:24 +0000 (+0200) Subject: adjusted position calculation of battle ui X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=c8dccd84477d10dcd3ec884478a9f26c16b54ad7;p=l2e.git adjusted position calculation of battle ui --- diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 36c1997..2b46cac 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -112,15 +112,16 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector &offset) { } void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector &offset) { - int uiHeight(BackgroundHeight() / 2), uiOffset(uiHeight); - int tagHeight((uiHeight - attackTypeMenu.IconHeight()) / 2); - int tagWidth((BackgroundWidth() - attackTypeMenu.IconWidth()) / 2); + int margin(attackTypeMenu.Height() / 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 tagPosition[4]; - tagPosition[0] = Point(0, uiOffset); - tagPosition[1] = Point(tagWidth + attackTypeMenu.IconWidth(), uiOffset); - tagPosition[2] = Point(0, uiOffset + tagHeight + attackTypeMenu.IconHeight()); - tagPosition[3] = Point(tagWidth + attackTypeMenu.IconWidth(), uiOffset + tagHeight + attackTypeMenu.IconHeight()); + tagPosition[0] = Point(xOffset, BackgroundHeight() - 2 * tagHeight - margin); + tagPosition[1] = Point(xOffset + tagWidth + 2 * margin, BackgroundHeight() - 2 * tagHeight - margin); + tagPosition[2] = Point(xOffset, BackgroundHeight() - tagHeight - margin); + tagPosition[3] = Point(xOffset + tagWidth + 2 * margin, BackgroundHeight() - tagHeight - margin); for (vector::size_type i(0), end(heroTags.size()); i < end; ++i) { heroTags[i].Render(screen, tagWidth, tagHeight, tagPosition[i] + offset, (int)i == activeHero); diff --git a/src/battle/states/SelectAttackType.cpp b/src/battle/states/SelectAttackType.cpp index c7a65be..2664295 100644 --- a/src/battle/states/SelectAttackType.cpp +++ b/src/battle/states/SelectAttackType.cpp @@ -101,7 +101,7 @@ void SelectAttackType::Render(SDL_Surface *screen) { void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector &offset) { Point position( (battle->BackgroundWidth() - battle->GetAttackTypeMenu().Width()) / 2, - (battle->BackgroundHeight() * 3 / 4) - (battle->GetAttackTypeMenu().Height() / 2)); + battle->BackgroundHeight() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2); battle->GetAttackTypeMenu().Render(screen, position + offset); } diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index bee880b..5631e69 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -83,7 +83,7 @@ void SelectMoveAction::Render(SDL_Surface *screen) { void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector &offset) { Point position( (battle->BackgroundWidth() - battle->GetMoveMenu().Width()) / 2, - (battle->BackgroundHeight() * 3 / 4) - (battle->GetMoveMenu().Height() / 2)); + battle->BackgroundHeight() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2); battle->GetMoveMenu().Render(screen, position + offset); } diff --git a/test-data/battle-bg.png b/test-data/battle-bg.png index 7913872..4c8a0af 100644 Binary files a/test-data/battle-bg.png and b/test-data/battle-bg.png differ