From: Daniel Karbach Date: Mon, 13 Aug 2012 19:57:54 +0000 (+0200) Subject: renamed BattleState's background functions X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;ds=sidebyside;h=8f6a2452408f4ae35396cd7008a6fab0ecb03a46;p=l2e.git renamed BattleState's background functions BackgroundWidth() => Width() BackgroundHeight() => Height() --- diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index a4e8158..db221b4 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -83,16 +83,16 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) { int tagHeight(attackTypeMenu.Height()); int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2); - int xOffset((BackgroundWidth() - 2 * tagWidth) / 2); - heroTagPositions[0] = Point(xOffset, BackgroundHeight() - 2 * tagHeight); - heroTagPositions[1] = Point(xOffset + tagWidth, BackgroundHeight() - 2 * tagHeight); - heroTagPositions[2] = Point(xOffset, BackgroundHeight() - tagHeight); - heroTagPositions[3] = Point(xOffset + tagWidth, BackgroundHeight() - tagHeight); + int xOffset((Width() - 2 * tagWidth) / 2); + heroTagPositions[0] = Point(xOffset, Height() - 2 * tagHeight); + heroTagPositions[1] = Point(xOffset + tagWidth, Height() - 2 * tagHeight); + heroTagPositions[2] = Point(xOffset, Height() - tagHeight); + heroTagPositions[3] = Point(xOffset + tagWidth, Height() - tagHeight); tagHeight = res->normalFont->CharHeight() * 4 + res->smallHeroTagFrame->BorderHeight() * 2; tagWidth = res->normalFont->CharWidth() * 6 + res->smallHeroTagFrame->BorderWidth() * 2; - xOffset = (BackgroundWidth() - 4 * tagWidth) / 2; - int yOffset(BackgroundHeight() - tagHeight); + xOffset = (Width() - 4 * tagWidth) / 2; + int yOffset(Height() - tagHeight); smallHeroTagPositions[0] = Point(xOffset, yOffset); smallHeroTagPositions[1] = Point(xOffset + 2 * tagWidth, yOffset); smallHeroTagPositions[2] = Point(xOffset + tagWidth, yOffset); @@ -316,8 +316,8 @@ void BattleState::RenderSmallHeroTags(SDL_Surface *screen, const Vector &of SDL_Rect rect; rect.x = offset.X(); - rect.y = offset.Y() + BackgroundHeight() - tagHeight; - rect.w = BackgroundWidth(); + rect.y = offset.Y() + Height() - tagHeight; + rect.w = Width(); rect.h = tagHeight; SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, 0, 0, 0)); rect.y += res->normalFont->CharHeight() / 8; diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index d0a0027..3acc0b7 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -133,8 +133,8 @@ public: (screen->w - background->w) / 2, (screen->h - background->h) / 2); } - int BackgroundWidth() const { return background->w; } - int BackgroundHeight() const { return background->h; } + int Width() const { return background->w; } + int Height() const { return background->h; } void RenderBackground(SDL_Surface *screen, const geometry::Vector &offset); void RenderMonsters(SDL_Surface *screen, const geometry::Vector &offset); diff --git a/src/battle/states/PerformAttacks.cpp b/src/battle/states/PerformAttacks.cpp index b5cd9be..dd0e0df 100644 --- a/src/battle/states/PerformAttacks.cpp +++ b/src/battle/states/PerformAttacks.cpp @@ -181,10 +181,10 @@ void PerformAttacks::RenderTitleBar(SDL_Surface *screen, const Vector &offs if (!titleBarText || !titleBarTimer.Running()) return; int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight()); - battle->Res().titleFrame->Draw(screen, Point(offset.X(), offset.Y()), battle->BackgroundWidth(), height); + battle->Res().titleFrame->Draw(screen, Point(offset.X(), offset.Y()), battle->Width(), height); Point textPosition( - (battle->BackgroundWidth() - (std::strlen(titleBarText) * battle->Res().titleFont->CharWidth())) / 2, + (battle->Width() - (std::strlen(titleBarText) * battle->Res().titleFont->CharWidth())) / 2, battle->Res().titleFrame->BorderHeight()); battle->Res().titleFont->DrawString(titleBarText, screen, textPosition + offset); } diff --git a/src/battle/states/RunState.cpp b/src/battle/states/RunState.cpp index 1a90e28..155313f 100644 --- a/src/battle/states/RunState.cpp +++ b/src/battle/states/RunState.cpp @@ -70,10 +70,10 @@ void RunState::Render(SDL_Surface *screen) { void RunState::RenderTitleBar(SDL_Surface *screen, const Vector &offset) { int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight()); - battle->Res().titleFrame->Draw(screen, Point(offset.X(), offset.Y()), battle->BackgroundWidth(), height); + battle->Res().titleFrame->Draw(screen, Point(offset.X(), offset.Y()), battle->Width(), height); Point textPosition( - (battle->BackgroundWidth() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2, + (battle->Width() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2, battle->Res().titleFrame->BorderHeight()); battle->Res().titleFont->DrawString(battle->Res().escapeText, screen, textPosition + offset); } diff --git a/src/battle/states/SelectAttackType.cpp b/src/battle/states/SelectAttackType.cpp index 1726092..f8ad21d 100644 --- a/src/battle/states/SelectAttackType.cpp +++ b/src/battle/states/SelectAttackType.cpp @@ -125,8 +125,8 @@ 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() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2); + (battle->Width() - battle->GetAttackTypeMenu().Width()) / 2, + battle->Height() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2); battle->GetAttackTypeMenu().Render(screen, position + offset); } diff --git a/src/battle/states/SelectIkari.cpp b/src/battle/states/SelectIkari.cpp index 97a951d..7ccfdc4 100644 --- a/src/battle/states/SelectIkari.cpp +++ b/src/battle/states/SelectIkari.cpp @@ -111,7 +111,7 @@ void SelectIkari::Render(SDL_Surface *screen) { void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector &offset) { const Frame *frame(battle->Res().selectFrame); Point position(frame->BorderWidth(), frame->BorderHeight()); - int width(battle->BackgroundWidth() - 2 * frame->BorderWidth()); + int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); } diff --git a/src/battle/states/SelectItem.cpp b/src/battle/states/SelectItem.cpp index 22369f3..0291b73 100644 --- a/src/battle/states/SelectItem.cpp +++ b/src/battle/states/SelectItem.cpp @@ -110,7 +110,7 @@ void SelectItem::Render(SDL_Surface *screen) { void SelectItem::RenderFrame(SDL_Surface *screen, const Vector &offset) { const Frame *frame(battle->Res().selectFrame); Point position(frame->BorderWidth(), frame->BorderHeight()); - int width(battle->BackgroundWidth() - 2 * frame->BorderWidth()); + int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); } diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index 8aa4906..7eb8fbe 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -84,8 +84,8 @@ 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() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2); + (battle->Width() - battle->GetMoveMenu().Width()) / 2, + battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2); battle->GetMoveMenu().Render(screen, position + offset); } diff --git a/src/battle/states/SelectSpell.cpp b/src/battle/states/SelectSpell.cpp index a13d8fc..f8b00e5 100644 --- a/src/battle/states/SelectSpell.cpp +++ b/src/battle/states/SelectSpell.cpp @@ -111,7 +111,7 @@ void SelectSpell::Render(SDL_Surface *screen) { void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector &offset) { const Frame *frame(battle->Res().selectFrame); Point position(frame->BorderWidth(), frame->BorderHeight()); - int width(battle->BackgroundWidth() - 2 * frame->BorderWidth()); + int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); }