From: Daniel Karbach Date: Wed, 22 Aug 2012 20:35:37 +0000 (+0200) Subject: merged Point into Vector X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=0542849dfccfec1ce1477265fa0fee2401a8fb23;p=l2e.git merged Point into Vector this should make some stuff a lot easier --- diff --git a/src/battle/AttackTypeMenu.cpp b/src/battle/AttackTypeMenu.cpp index 2ec7a1f..b18c522 100644 --- a/src/battle/AttackTypeMenu.cpp +++ b/src/battle/AttackTypeMenu.cpp @@ -7,16 +7,14 @@ #include "AttackTypeMenu.h" -#include "../geometry/operators.h" #include "../geometry/Vector.h" #include "../graphics/Sprite.h" -using geometry::Point; using geometry::Vector; namespace battle { -void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Point &position) { +void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Vector &position) { Vector swordOffset(IconWidth(), IconHeight()); Vector magicOffset(IconWidth(), 0); Vector defendOffset(2 * IconWidth(), IconHeight()); diff --git a/src/battle/AttackTypeMenu.h b/src/battle/AttackTypeMenu.h index 4b38dd3..d31d63b 100644 --- a/src/battle/AttackTypeMenu.h +++ b/src/battle/AttackTypeMenu.h @@ -9,7 +9,7 @@ #define BATTLE_ATTACKTYPEMENU_H_ #include "AttackChoice.h" -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include "../graphics/Sprite.h" #include @@ -25,7 +25,7 @@ public: public: void Select(AttackChoice::Type t) { selected = t; } AttackChoice::Type Selected() const { return selected; } - void Render(SDL_Surface *screen, const geometry::Point &position); + void Render(SDL_Surface *screen, const geometry::Vector &position); int Width() const { return 3 * IconWidth(); } int Height() const { return 3 * IconHeight(); } diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index ae88731..f548f2d 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -16,7 +16,6 @@ #include "../common/Inventory.h" #include "../common/Item.h" #include "../common/Spell.h" -#include "../geometry/operators.h" #include "../graphics/Frame.h" #include "../graphics/Sprite.h" @@ -30,7 +29,6 @@ using app::Input; using common::Inventory; using common::Item; using common::Spell; -using geometry::Point; using geometry::Vector; using graphics::Menu; @@ -97,19 +95,19 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) { int tagHeight(attackTypeMenu.Height()); int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2); 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); + heroTagPositions[0] = Vector(xOffset, Height() - 2 * tagHeight); + heroTagPositions[1] = Vector(xOffset + tagWidth, Height() - 2 * tagHeight); + heroTagPositions[2] = Vector(xOffset, Height() - tagHeight); + heroTagPositions[3] = Vector(xOffset + tagWidth, Height() - tagHeight); tagHeight = res->normalFont->CharHeight() * 4 + res->smallHeroTagFrame->BorderHeight() * 2; tagWidth = res->normalFont->CharWidth() * 6 + res->smallHeroTagFrame->BorderWidth() * 2; 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); - smallHeroTagPositions[3] = Point(xOffset + 3 * tagWidth, yOffset); + smallHeroTagPositions[0] = Vector(xOffset, yOffset); + smallHeroTagPositions[1] = Vector(xOffset + 2 * tagWidth, yOffset); + smallHeroTagPositions[2] = Vector(xOffset + tagWidth, yOffset); + smallHeroTagPositions[3] = Vector(xOffset + 3 * tagWidth, yOffset); itemMenu = res->itemMenuPrototype; LoadInventory(); diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index a6ba398..27953cd 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -16,7 +16,6 @@ #include "Resources.h" #include "SmallHeroTag.h" #include "../app/State.h" -#include "../geometry/Point.h" #include "../geometry/Vector.h" #include "../graphics/Animation.h" #include "../graphics/Menu.h" @@ -99,7 +98,7 @@ public: const Monster &MonsterAt(int index) const { assert(index >= 0 && index < NumHeroes()); return monsters[index]; } const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; } - const geometry::Point &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; } + const geometry::Vector &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; } bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; } bool AttackSelectionDone() const { return activeHero >= numHeroes; } @@ -167,8 +166,8 @@ private: graphics::Menu itemMenu; HeroTag heroTags[4]; SmallHeroTag smallHeroTags[4]; - geometry::Point heroTagPositions[4]; - geometry::Point smallHeroTagPositions[4]; + geometry::Vector heroTagPositions[4]; + geometry::Vector smallHeroTagPositions[4]; int numHeroes; int activeHero; int attackCursor; diff --git a/src/battle/Hero.h b/src/battle/Hero.h index 7444902..1cce110 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -10,7 +10,7 @@ #include "AttackChoice.h" #include "Stats.h" -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include "../graphics/Animation.h" #include "../graphics/Menu.h" @@ -88,8 +88,8 @@ public: const graphics::Animation *AttackAnimation() const { return attackAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } - geometry::Point &Position() { return position; } - const geometry::Point &Position() const { return position; } + geometry::Vector &Position() { return position; } + const geometry::Vector &Position() const { return position; } graphics::Menu &SpellMenu() { return spellMenu; } const graphics::Menu &SpellMenu() const { return spellMenu; } @@ -147,7 +147,7 @@ private: graphics::AnimationRunner animation; - geometry::Point position; + geometry::Vector position; graphics::Menu spellMenu; graphics::Menu ikariMenu; diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 228bfda..7938250 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -11,14 +11,12 @@ #include "BattleState.h" #include "Hero.h" #include "Resources.h" -#include "../geometry/operators.h" #include "../geometry/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Gauge.h" #include "../graphics/Sprite.h" -using geometry::Point; using geometry::Vector; using graphics::Frame; @@ -28,7 +26,7 @@ const graphics::Sprite *HeroTag::HeroSprite() const { return battle->HeroAt(index).Sprite(); } -void HeroTag::Render(SDL_Surface *screen, int width, int height, Point position, bool active) const { +void HeroTag::Render(SDL_Surface *screen, int width, int height, Vector position, bool active) const { const Resources &r(battle->Res()); // frame diff --git a/src/battle/HeroTag.h b/src/battle/HeroTag.h index f1408fd..43dc661 100644 --- a/src/battle/HeroTag.h +++ b/src/battle/HeroTag.h @@ -9,7 +9,6 @@ #define BATTLE_HEROTAG_H_ #include "Hero.h" -#include "../geometry/Point.h" #include "../geometry/Vector.h" #include @@ -36,7 +35,7 @@ public: const graphics::Sprite *HeroSprite() const; geometry::Vector HeroOffset() const; - void Render(SDL_Surface *screen, int width, int height, geometry::Point position, bool active) const; + void Render(SDL_Surface *screen, int width, int height, geometry::Vector position, bool active) const; private: const BattleState *battle; diff --git a/src/battle/Monster.h b/src/battle/Monster.h index 8338cb1..c125672 100644 --- a/src/battle/Monster.h +++ b/src/battle/Monster.h @@ -10,7 +10,7 @@ #include "AttackChoice.h" #include "Stats.h" -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include "../graphics/Animation.h" #include @@ -62,8 +62,8 @@ public: const graphics::Animation *AttackAnimation() const { return attackAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } - geometry::Point &Position() { return position; } - const geometry::Point &Position() const { return position; } + geometry::Vector &Position() { return position; } + const geometry::Vector &Position() const { return position; } // temporary setters until loader is implemented public: @@ -97,7 +97,7 @@ private: graphics::AnimationRunner animation; - geometry::Point position; + geometry::Vector position; AttackChoice attackChoice; diff --git a/src/battle/MoveMenu.cpp b/src/battle/MoveMenu.cpp index 4d5ff79..849f694 100644 --- a/src/battle/MoveMenu.cpp +++ b/src/battle/MoveMenu.cpp @@ -7,16 +7,14 @@ #include "MoveMenu.h" -#include "../geometry/operators.h" #include "../geometry/Vector.h" #include "../graphics/Sprite.h" -using geometry::Point; using geometry::Vector; namespace battle { -void MoveMenu::Render(SDL_Surface *screen, const geometry::Point &position) { +void MoveMenu::Render(SDL_Surface *screen, const geometry::Vector &position) { Vector attackOffset(0, IconHeight()); Vector changeOffset(0, 0); Vector runOffset(0, 2 * IconHeight()); diff --git a/src/battle/MoveMenu.h b/src/battle/MoveMenu.h index 771fcb8..63b9d88 100644 --- a/src/battle/MoveMenu.h +++ b/src/battle/MoveMenu.h @@ -8,7 +8,7 @@ #ifndef BATTLE_MOVEMENU_H_ #define BATTLE_MOVEMENU_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include "../graphics/Sprite.h" namespace battle { @@ -30,7 +30,7 @@ public: public: void Select(Icon i) { selected = i; } Icon Selected() const { return selected; } - void Render(SDL_Surface *screen, const geometry::Point &position); + void Render(SDL_Surface *screen, const geometry::Vector &position); int Width() const { return IconWidth(); } int Height() const { return 3 * IconHeight(); } diff --git a/src/battle/NumberAnimation.cpp b/src/battle/NumberAnimation.cpp index 17eb771..fcc707f 100644 --- a/src/battle/NumberAnimation.cpp +++ b/src/battle/NumberAnimation.cpp @@ -7,11 +7,9 @@ #include "NumberAnimation.h" -#include "../geometry/operators.h" #include "../geometry/Vector.h" using app::State; -using geometry::Point; using geometry::Vector; using graphics::Animation; using graphics::AnimationRunner; @@ -87,8 +85,8 @@ int NumberAnimation::Height() const { return animation[0].GetSprite()->Height(); } -void NumberAnimation::Draw(SDL_Surface *dest, const Point &positionIn) const { - Point position(positionIn); +void NumberAnimation::Draw(SDL_Surface *dest, const Vector &positionIn) const { + Vector position(positionIn); Vector step(animation[0].GetSprite()->Width(), 0); if (number > 999) { if (animation[0].Running()) { diff --git a/src/battle/NumberAnimation.h b/src/battle/NumberAnimation.h index 08ca01f..f753056 100644 --- a/src/battle/NumberAnimation.h +++ b/src/battle/NumberAnimation.h @@ -10,7 +10,7 @@ #include "../graphics/Animation.h" -#include "../geometry/Point.h" +#include "../geometry/Vector.h" namespace app { class Application; @@ -33,7 +33,7 @@ public: int Width() const; int Height() const; - void Draw(SDL_Surface *dest, const geometry::Point &position) const; + void Draw(SDL_Surface *dest, const geometry::Vector &position) const; private: int number; diff --git a/src/battle/PartyLayout.cpp b/src/battle/PartyLayout.cpp index e1fd33f..6389327 100644 --- a/src/battle/PartyLayout.cpp +++ b/src/battle/PartyLayout.cpp @@ -7,9 +7,6 @@ #include "PartyLayout.h" -using geometry::Point; -using std::vector; - namespace battle { } diff --git a/src/battle/PartyLayout.h b/src/battle/PartyLayout.h index 6844139..1d72aa8 100644 --- a/src/battle/PartyLayout.h +++ b/src/battle/PartyLayout.h @@ -8,7 +8,7 @@ #ifndef BATTLE_PARTYLAYOUT_H_ #define BATTLE_PARTYLAYOUT_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include #include @@ -22,34 +22,34 @@ public: PartyLayout() { } public: - std::vector >::size_type NumPositions() const { return positions.size(); } + std::vector >::size_type NumPositions() const { return positions.size(); } template - void CalculatePositions(U width, U height, std::vector > &dest) const { + void CalculatePositions(U width, U height, std::vector > &dest) const { dest.clear(); dest.reserve(positions.size()); - for (std::vector >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) { - dest.push_back(geometry::Point( + for (std::vector >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) { + dest.push_back(geometry::Vector( i->X() * width / 255, i->Y() * height / 223 )); } } template - geometry::Point CalculatePosition(std::vector >::size_type index, U width, U height) const { + geometry::Vector CalculatePosition(std::vector >::size_type index, U width, U height) const { assert(index >= 0 && index < positions.size()); - return geometry::Point( + return geometry::Vector( positions[index].X() * width / 255, positions[index].Y() * height / 223 ); } public: - void AddPosition(const geometry::Point &p) { + void AddPosition(const geometry::Vector &p) { positions.push_back(p); } private: - std::vector > positions; + std::vector > positions; }; diff --git a/src/battle/SmallHeroTag.cpp b/src/battle/SmallHeroTag.cpp index 7843cc0..0bc160a 100644 --- a/src/battle/SmallHeroTag.cpp +++ b/src/battle/SmallHeroTag.cpp @@ -8,13 +8,11 @@ #include "SmallHeroTag.h" #include "BattleState.h" -#include "../geometry/operators.h" #include "../geometry/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Gauge.h" -using geometry::Point; using geometry::Vector; using graphics::Font; using graphics::Frame; @@ -22,7 +20,7 @@ using graphics::Sprite; namespace battle { -void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, geometry::Point position) const { +void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, geometry::Vector position) const { const Resources &r(battle->Res()); const Frame *frame((index == battle->MaxHeroes() - 1) ? r.lastSmallHeroTagFrame : r.smallHeroTagFrame); const Font *font(r.normalFont); diff --git a/src/battle/SmallHeroTag.h b/src/battle/SmallHeroTag.h index 1f392c3..acd2d31 100644 --- a/src/battle/SmallHeroTag.h +++ b/src/battle/SmallHeroTag.h @@ -8,7 +8,7 @@ #ifndef BATTLE_SMALLHEROTAG_H_ #define BATTLE_SMALLHEROTAG_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include @@ -29,7 +29,7 @@ public: SmallHeroTag(const BattleState *battle, int heroIndex) : battle(battle), index(heroIndex) { } - void Render(SDL_Surface *screen, int width, int height, geometry::Point position) const; + void Render(SDL_Surface *screen, int width, int height, geometry::Vector position) const; private: const BattleState *battle; diff --git a/src/battle/states/PerformAttacks.cpp b/src/battle/states/PerformAttacks.cpp index 6aae5d7..a01a8fe 100644 --- a/src/battle/states/PerformAttacks.cpp +++ b/src/battle/states/PerformAttacks.cpp @@ -15,8 +15,6 @@ #include "../../common/Ikari.h" #include "../../common/Item.h" #include "../../common/Spell.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" #include "../../graphics/Animation.h" #include "../../graphics/Font.h" #include "../../graphics/Frame.h" @@ -25,7 +23,6 @@ using app::Application; using app::Input; -using geometry::Point; using geometry::Vector; using graphics::AnimationRunner; using std::vector; @@ -231,9 +228,9 @@ 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->Width(), height); + battle->Res().titleFrame->Draw(screen, Vector(offset.X(), offset.Y()), battle->Width(), height); - Point textPosition( + Vector textPosition( (battle->Width() - (std::strlen(titleBarText) * battle->Res().titleFont->CharWidth())) / 2, battle->Res().titleFrame->BorderHeight()); battle->Res().titleFont->DrawString(titleBarText, screen, textPosition + offset); @@ -252,13 +249,13 @@ void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry:: if (!targetAnimation.Valid() || !targetAnimation.Running()) return; const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection()); if (ts.TargetsHeroes()) { - for (vector >::size_type i(0), end(battle->NumHeroes()); i < end; ++i) { + for (vector >::size_type i(0), end(battle->NumHeroes()); i < end; ++i) { if (ts.IsSelected(i)) { targetAnimation.DrawCenter(screen, battle->HeroAt(i).Position() + offset); } } } else { - for (vector >::size_type i(0), end(battle->MaxMonsters()); i < end; ++i) { + for (vector >::size_type i(0), end(battle->MaxMonsters()); i < end; ++i) { if (ts.IsSelected(i)) { targetAnimation.DrawCenter(screen, battle->MonsterAt(i).Position() + offset); } diff --git a/src/battle/states/PerformAttacks.h b/src/battle/states/PerformAttacks.h index d060d5a..19c6967 100644 --- a/src/battle/states/PerformAttacks.h +++ b/src/battle/states/PerformAttacks.h @@ -59,7 +59,7 @@ private: app::Timer titleBarTimer; app::Timer targetAnimationTimer; std::vector numberAnimation; - std::vector > numberPosition; + std::vector > numberPosition; int cursor; }; diff --git a/src/battle/states/RunState.cpp b/src/battle/states/RunState.cpp index 155313f..a22f438 100644 --- a/src/battle/states/RunState.cpp +++ b/src/battle/states/RunState.cpp @@ -10,8 +10,7 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" +#include "../../geometry/Vector.h" #include "../../graphics/Font.h" #include "../../graphics/Frame.h" @@ -19,7 +18,6 @@ using app::Application; using app::Input; -using geometry::Point; using geometry::Vector; namespace battle { @@ -70,9 +68,9 @@ 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->Width(), height); + battle->Res().titleFrame->Draw(screen, Vector(offset.X(), offset.Y()), battle->Width(), height); - Point textPosition( + Vector textPosition( (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 7f36681..fbd4333 100644 --- a/src/battle/states/SelectAttackType.cpp +++ b/src/battle/states/SelectAttackType.cpp @@ -17,14 +17,12 @@ #include "../../app/Application.h" #include "../../app/Input.h" #include "../../common/Item.h" -#include "../../geometry/operators.h" #include using app::Application; using app::Input; using common::Item; -using geometry::Point; using geometry::Vector; namespace battle { @@ -136,7 +134,7 @@ void SelectAttackType::Render(SDL_Surface *screen) { } void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector &offset) { - Point position( + Vector position( (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 4fce8c7..7647e28 100644 --- a/src/battle/states/SelectIkari.cpp +++ b/src/battle/states/SelectIkari.cpp @@ -14,14 +14,11 @@ #include "../../app/Input.h" #include "../../common/Ikari.h" #include "../../common/Item.h" -#include "../../geometry/Point.h" -#include "../../geometry/operators.h" #include "../../graphics/Frame.h" using app::Application; using app::Input; using common::Ikari; -using geometry::Point; using geometry::Vector; using graphics::Frame; @@ -111,7 +108,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()); + Vector position(frame->BorderWidth(), frame->BorderHeight()); int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); @@ -119,7 +116,7 @@ void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector &offset) { void SelectIkari::RenderHeadline(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight()); res.normalFont->DrawString(res.itemMenuHeadline, screen, position + offset); @@ -127,7 +124,7 @@ void SelectIkari::RenderHeadline(SDL_Surface *screen, const Vector &offset) void SelectIkari::RenderMenu(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight()); battle->ActiveHero().IkariMenu().Draw(screen, position + offset); diff --git a/src/battle/states/SelectItem.cpp b/src/battle/states/SelectItem.cpp index 4c197ff..f58a78e 100644 --- a/src/battle/states/SelectItem.cpp +++ b/src/battle/states/SelectItem.cpp @@ -13,14 +13,11 @@ #include "../../app/Application.h" #include "../../app/Input.h" #include "../../common/Item.h" -#include "../../geometry/Point.h" -#include "../../geometry/operators.h" #include "../../graphics/Frame.h" using app::Application; using app::Input; using common::Item; -using geometry::Point; using geometry::Vector; using graphics::Frame; @@ -110,7 +107,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()); + Vector position(frame->BorderWidth(), frame->BorderHeight()); int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); @@ -118,7 +115,7 @@ void SelectItem::RenderFrame(SDL_Surface *screen, const Vector &offset) { void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight()); res.normalFont->DrawString(res.itemMenuHeadline, screen, position + offset); @@ -126,7 +123,7 @@ void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector &offset) void SelectItem::RenderMenu(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight()); battle->ItemMenu().Draw(screen, position + offset); diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index 7eb8fbe..b2cac81 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -14,11 +14,9 @@ #include "../MoveMenu.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" using app::Application; using app::Input; -using geometry::Point; using geometry::Vector; namespace battle { @@ -83,7 +81,7 @@ void SelectMoveAction::Render(SDL_Surface *screen) { } void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector &offset) { - Point position( + Vector position( (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 1bc195c..65cd8cc 100644 --- a/src/battle/states/SelectSpell.cpp +++ b/src/battle/states/SelectSpell.cpp @@ -14,14 +14,11 @@ #include "../../app/Application.h" #include "../../app/Input.h" #include "../../common/Spell.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" #include "../../graphics/Frame.h" using app::Application; using app::Input; using common::Spell; -using geometry::Point; using geometry::Vector; using graphics::Frame; @@ -111,7 +108,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()); + Vector position(frame->BorderWidth(), frame->BorderHeight()); int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); @@ -119,7 +116,7 @@ void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector &offset) { void SelectSpell::RenderHeadline(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight()); res.normalFont->DrawString(res.spellMenuHeadline, screen, position + offset); @@ -127,7 +124,7 @@ void SelectSpell::RenderHeadline(SDL_Surface *screen, const Vector &offset) void SelectSpell::RenderMenu(SDL_Surface *screen, const Vector &offset) { const Resources &res(battle->Res()); - Point position( + Vector position( 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), 2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight()); battle->ActiveHero().SpellMenu().Draw(screen, position + offset); diff --git a/src/battle/states/SelectTarget.cpp b/src/battle/states/SelectTarget.cpp index 37f2da9..f15f455 100644 --- a/src/battle/states/SelectTarget.cpp +++ b/src/battle/states/SelectTarget.cpp @@ -11,12 +11,9 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" using app::Application; using app::Input; -using geometry::Point; using geometry::Vector; using std::vector; @@ -93,7 +90,7 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector cursorOffset(cursorIcon->Width() / -2, cursorIcon->Height()); // offset the indicator by 1/8th to the right and top Vector indicatorOffset(cursorOffset + Vector(cursorIcon->Width() / 8, cursorIcon->Height() / -8)); - vector > positions; + vector > positions; if (selection->TargetsMonsters()) { for (int i(0), end(battle->MaxMonsters()); i < end; ++i) { positions.push_back(battle->MonsterAt(i).Position()); @@ -104,7 +101,7 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector >::size_type i(0); i < positions.size(); ++i) { + for (vector >::size_type i(0); i < positions.size(); ++i) { if (selection->IsSelected(i)) { cursorIcon->DrawTopRight(screen, positions[i] + indicatorOffset + offset); } diff --git a/src/battle/states/SwapHeroes.cpp b/src/battle/states/SwapHeroes.cpp index 568fe88..5c83f74 100644 --- a/src/battle/states/SwapHeroes.cpp +++ b/src/battle/states/SwapHeroes.cpp @@ -11,12 +11,9 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" using app::Application; using app::Input; -using geometry::Point; using geometry::Vector; using std::vector; @@ -127,7 +124,7 @@ void SwapHeroes::RenderCursors(SDL_Surface *screen, const geometry::Vector // offset the cursor by 1/8th to the left and bottom Vector cursorOffset(battle->Res().swapCursor->Width() / -8, battle->Res().swapCursor->Height() / 8); Vector indicatorOffset(0, 0); - vector > positions; + vector > positions; for (int i(0), end(battle->NumHeroes()); i < end; ++i) { Vector positionCorrection(battle->Res().swapCursor->Width() / 2, battle->HeroTagAt(i).HeroSprite()->Height() - battle->Res().swapCursor->Height() / 2); // indicator offsets are inverted for heroes @@ -135,7 +132,7 @@ void SwapHeroes::RenderCursors(SDL_Surface *screen, const geometry::Vector positions.push_back(battle->HeroTagPositionAt(i) + battle->HeroTagAt(i).HeroOffset() + positionCorrection); } if (flipFlop) { - for (vector >::size_type i(0); i < positions.size(); ++i) { + for (vector >::size_type i(0); i < positions.size(); ++i) { if (selected == int(i)) { battle->Res().swapCursor->DrawTopRight(screen, positions[i] + offset); } diff --git a/src/geometry/Point.h b/src/geometry/Point.h deleted file mode 100644 index 9d4bd85..0000000 --- a/src/geometry/Point.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Point.h - * - * Created on: Aug 5, 2012 - * Author: holy - */ - -#ifndef GEOMETRY_POINT_H_ -#define GEOMETRY_POINT_H_ - -namespace geometry { - -template -class Point { - -public: - Point() : x(0), y(0) { } - Point(T x, T y) : x(x), y(y) { } - -public: - T X() const { return x; } - T Y() const { return y; } - -private: - T x, y; - -}; - -} - -#endif /* GEOMETRY_POINT_H_ */ diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h index d7d0f3d..bf64713 100644 --- a/src/geometry/Vector.h +++ b/src/geometry/Vector.h @@ -8,6 +8,8 @@ #ifndef GEOMETRY_VECTOR_H_ #define GEOMETRY_VECTOR_H_ +#include + namespace geometry { template @@ -30,6 +32,52 @@ private: }; + +template +inline Vector operator +(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); +} + +template +inline Vector &operator +=(Vector &lhs, const Vector &rhs) { + return lhs = lhs + rhs; +} + +template +inline Vector operator -(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); +} + +template +inline Vector &operator -=(Vector &lhs, const Vector &rhs) { + return lhs = lhs - rhs; +} + +template +inline Vector operator -(const Vector &v) { + return Vector(-v.X(), -v.Y()); +} + +template +inline Vector operator *(const Vector &v, T s) { + return Vector(v.X() * s, v.Y() * s); +} +template +inline Vector operator *(T s, const Vector &v) { + return Vector(s * v.X(), s * v.Y()); +} + +template +inline Vector operator /(const Vector &v, T s) { + return Vector(v.X() / s, v.Y() / s); +} + +template +inline std::ostream &operator <<(std::ostream &out, const Vector &v) { + out << '<' << v.X() << ", " << v.Y() << '>'; + return out; +} + } #endif /* GEOMETRY_VECTOR_H_ */ diff --git a/src/geometry/operators.h b/src/geometry/operators.h deleted file mode 100644 index 295daa1..0000000 --- a/src/geometry/operators.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * operators.h - * - * Created on: Aug 6, 2012 - * Author: holy - */ - -#ifndef GEOMETRY_OPERATORS_H_ -#define GEOMETRY_OPERATORS_H_ - -#include "Point.h" -#include "Vector.h" - -#include - -namespace geometry { - -template -inline Vector operator +(const Vector &lhs, const Vector &rhs) { - return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); -} -template -inline Point operator +(const Point &lhs, const Vector &rhs) { - return Point(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); -} - -template -inline Vector &operator +=(Vector &lhs, const Vector &rhs) { - return lhs = lhs + rhs; -} -template -inline Point &operator +=(Point &lhs, const Vector &rhs) { - return lhs = lhs + rhs; -} - -template -inline Vector operator -(const Vector &lhs, const Vector &rhs) { - return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); -} -template -inline Point operator -(const Point &lhs, const Vector &rhs) { - return Point(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); -} - -template -inline Vector &operator -=(Vector &lhs, const Vector &rhs) { - return lhs = lhs - rhs; -} -template -inline Point &operator -=(Point &lhs, const Vector &rhs) { - return lhs = lhs - rhs; -} - -template -inline Vector operator -(const Vector &v) { - return Vector(-v.X(), -v.Y()); -} - -template -inline std::ostream &operator <<(std::ostream &out, const Point &p) { - out << '(' << p.X() << ", " << p.Y() << ')'; - return out; -} -template -inline std::ostream &operator <<(std::ostream &out, const Vector &v) { - out << '<' << v.X() << ", " << v.Y() << '>'; - return out; -} - -} - -#endif /* GEOMETRY_OPERATORS_H_ */ diff --git a/src/graphics/Animation.h b/src/graphics/Animation.h index 0baba35..e26bca9 100644 --- a/src/graphics/Animation.h +++ b/src/graphics/Animation.h @@ -12,8 +12,6 @@ #include "../app/Application.h" #include "../app/State.h" #include "../app/Timer.h" -#include "../geometry/operators.h" -#include "../geometry/Point.h" #include "../geometry/Vector.h" #include @@ -91,18 +89,18 @@ public: void ChangeSprite(const Sprite *s) { sprite = s; } const Sprite *GetSprite() const { return sprite; } - void Draw(SDL_Surface *dest, geometry::Point position) const { + void Draw(SDL_Surface *dest, geometry::Vector position) const { sprite->Draw(dest, position + animation->Offset(Frame()), animation->Col(Frame()) + ColOffset(), animation->Row(Frame()) + RowOffset()); } - void DrawTopRight(SDL_Surface *dest, geometry::Point position) const { + void DrawTopRight(SDL_Surface *dest, geometry::Vector position) const { geometry::Vector offset(-sprite->Width(), 0); Draw(dest, position + offset); } - void DrawCenter(SDL_Surface *dest, geometry::Point position) const { + void DrawCenter(SDL_Surface *dest, geometry::Vector position) const { geometry::Vector offset(-sprite->Width() / 2, -sprite->Height() / 2); Draw(dest, position + offset); } - void DrawCenterBottom(SDL_Surface *dest, geometry::Point position) const { + void DrawCenterBottom(SDL_Surface *dest, geometry::Vector position) const { geometry::Vector offset(-sprite->Width() / 2, -sprite->Height()); Draw(dest, position + offset); } diff --git a/src/graphics/Font.cpp b/src/graphics/Font.cpp index 1dc9051..a118500 100644 --- a/src/graphics/Font.cpp +++ b/src/graphics/Font.cpp @@ -7,42 +7,38 @@ #include "Font.h" -#include "../geometry/operators.h" -#include "../geometry/Vector.h" - #include -using geometry::Point; using geometry::Vector; using std::pow; namespace graphics { -void Font::DrawChar(char c, SDL_Surface *dest, const Point &position) const { +void Font::DrawChar(char c, SDL_Surface *dest, const Vector &position) const { int col(colOffset + (c % 0x10)); int row(rowOffset + (c / 0x10)); sprite->Draw(dest, position, col, row); } -void Font::DrawString(const char *s, SDL_Surface *dest, const Point &positionIn, int maxChars) const { - Point position(positionIn); +void Font::DrawString(const char *s, SDL_Surface *dest, const Vector &positionIn, int maxChars) const { + Vector position(positionIn); Vector step(CharWidth(), 0); for (int i(0); s[i] && (maxChars <= 0 || i < maxChars); ++i, position += step) { DrawChar(s[i], dest, position); } } -void Font::DrawDigit(int digit, SDL_Surface *dest, const Point &position) const { +void Font::DrawDigit(int digit, SDL_Surface *dest, const Vector &position) const { DrawChar(digit + 0x30, dest, position); } -void Font::DrawNumber(int numberIn, SDL_Surface *dest, const Point &positionIn, int digits) const { +void Font::DrawNumber(int numberIn, SDL_Surface *dest, const Vector &positionIn, int digits) const { int number(numberIn); if (digits > 0 && numberIn >= pow(10.0, digits)) { numberIn = pow(10.0, digits) - 1; } - Point position(positionIn); + Vector position(positionIn); Vector step(sprite->Width(), 0); if (digits > 0) { diff --git a/src/graphics/Font.h b/src/graphics/Font.h index c48ea16..8644802 100644 --- a/src/graphics/Font.h +++ b/src/graphics/Font.h @@ -9,7 +9,7 @@ #define GRAPHICS_FONT_H_ #include "Sprite.h" -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include @@ -26,10 +26,10 @@ public: public: int CharWidth() const { return sprite->Width(); } int CharHeight() const { return sprite->Height(); } - void DrawChar(char c, SDL_Surface *dest, const geometry::Point &position) const; - void DrawString(const char *s, SDL_Surface *dest, const geometry::Point &position, int maxChars = 0) const; - void DrawDigit(int d, SDL_Surface *dest, const geometry::Point &position) const; - void DrawNumber(int n, SDL_Surface *dest, const geometry::Point &position, int digits = 0) const; + void DrawChar(char c, SDL_Surface *dest, const geometry::Vector &position) const; + void DrawString(const char *s, SDL_Surface *dest, const geometry::Vector &position, int maxChars = 0) const; + void DrawDigit(int d, SDL_Surface *dest, const geometry::Vector &position) const; + void DrawNumber(int n, SDL_Surface *dest, const geometry::Vector &position, int digits = 0) const; private: const Sprite *sprite; diff --git a/src/graphics/Frame.cpp b/src/graphics/Frame.cpp index c682fa0..1c51c45 100644 --- a/src/graphics/Frame.cpp +++ b/src/graphics/Frame.cpp @@ -7,12 +7,12 @@ #include "Frame.h" -using geometry::Point; +using geometry::Vector; namespace graphics { // TODO: maybe create a cache for frames? -void Frame::Draw(SDL_Surface *dest, const Point &position, int width, int height) const { +void Frame::Draw(SDL_Surface *dest, const Vector &position, int width, int height) const { // top-left corner SDL_Rect srcRect; srcRect.x = xOffset; diff --git a/src/graphics/Frame.h b/src/graphics/Frame.h index d2e8dd4..74ce1f7 100644 --- a/src/graphics/Frame.h +++ b/src/graphics/Frame.h @@ -8,7 +8,7 @@ #ifndef GRAPHICS_FRAME_H_ #define GRAPHICS_FRAME_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include @@ -25,7 +25,7 @@ public: int MinHeight() const { return 2 * borderHeight; } int BorderWidth() const { return borderWidth; } int BorderHeight() const { return borderHeight; } - void Draw(SDL_Surface *dest, const geometry::Point &position, int width, int height) const; + void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, int height) const; private: SDL_Surface *surface; diff --git a/src/graphics/Gauge.cpp b/src/graphics/Gauge.cpp index 027d6b1..eda9942 100644 --- a/src/graphics/Gauge.cpp +++ b/src/graphics/Gauge.cpp @@ -7,11 +7,11 @@ #include "Gauge.h" -using geometry::Point; +using geometry::Vector; namespace graphics { -void Gauge::Draw(SDL_Surface *dest, const Point &position, int width, Uint8 fill) const { +void Gauge::Draw(SDL_Surface *dest, const Vector &position, int width, Uint8 fill) const { SDL_Rect srcRect, destRect; int filledWidth = fill * (width - startWidth - endWidth) / 255; diff --git a/src/graphics/Gauge.h b/src/graphics/Gauge.h index b5e30c2..fd81877 100644 --- a/src/graphics/Gauge.h +++ b/src/graphics/Gauge.h @@ -8,7 +8,7 @@ #ifndef GRAPHICS_GAUGE_H_ #define GRAPHICS_GAUGE_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include @@ -23,7 +23,7 @@ public: public: int MinWidth() const { return startWidth + endWidth; } int Height() const { return height; } - void Draw(SDL_Surface *dest, const geometry::Point &position, int width, Uint8 fill) const; + void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, Uint8 fill) const; private: SDL_Surface *surface; diff --git a/src/graphics/Menu.h b/src/graphics/Menu.h index c879cc9..f1a6d25 100644 --- a/src/graphics/Menu.h +++ b/src/graphics/Menu.h @@ -10,8 +10,6 @@ #include "Font.h" #include "Sprite.h" -#include "../geometry/operators.h" -#include "../geometry/Point.h" #include "../geometry/Vector.h" #include @@ -61,7 +59,7 @@ public: void Reserve(int n) { entries.reserve(n); } void Clear() { entries.clear(); } - void Draw(SDL_Surface *dest, const geometry::Point &position) const; + void Draw(SDL_Surface *dest, const geometry::Vector &position) const; private: int GetRow(int index) const { return index / cols; } @@ -196,7 +194,7 @@ void Menu::SelectIndex(int index) { template -void Menu::Draw(SDL_Surface *dest, const geometry::Point &position) const { +void Menu::Draw(SDL_Surface *dest, const geometry::Vector &position) const { int start(topRow * cols); int slots(rows * cols); int items(entries.size() - start); diff --git a/src/graphics/Sprite.cpp b/src/graphics/Sprite.cpp index 87ce8af..2c092de 100644 --- a/src/graphics/Sprite.cpp +++ b/src/graphics/Sprite.cpp @@ -7,11 +7,11 @@ #include "Sprite.h" -using geometry::Point; +using geometry::Vector; namespace graphics { -void Sprite::Draw(SDL_Surface *dest, const Point &position, int col, int row) const { +void Sprite::Draw(SDL_Surface *dest, const Vector &position, int col, int row) const { SDL_Rect srcRect, destRect; srcRect.x = xOffset + col * Width(); srcRect.y = yOffset + row * Height(); diff --git a/src/graphics/Sprite.h b/src/graphics/Sprite.h index 6aa6c94..942d98e 100644 --- a/src/graphics/Sprite.h +++ b/src/graphics/Sprite.h @@ -8,8 +8,6 @@ #ifndef GRAPHICS_SPRITE_H_ #define GRAPHICS_SPRITE_H_ -#include "../geometry/operators.h" -#include "../geometry/Point.h" #include "../geometry/Vector.h" #include @@ -25,16 +23,16 @@ public: public: int Width() const { return width; } int Height() const { return height; } - void Draw(SDL_Surface *dest, const geometry::Point &position, int col = 0, int row = 0) const; - void DrawTopRight(SDL_Surface *dest, const geometry::Point &position, int col = 0, int row = 0) const { + void Draw(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const; + void DrawTopRight(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const { geometry::Vector offset(-Width(), 0); Draw(dest, position + offset, col, row); } - void DrawCenter(SDL_Surface *dest, const geometry::Point &position, int col = 0, int row = 0) const { + void DrawCenter(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const { geometry::Vector offset(-Width() / 2, -Height() / 2); Draw(dest, position + offset, col, row); } - void DrawCenterBottom(SDL_Surface *dest, const geometry::Point &position, int col = 0, int row = 0) const { + void DrawCenterBottom(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const { geometry::Vector offset(-Width() / 2, -Height()); Draw(dest, position + offset, col, row); } diff --git a/src/main.cpp b/src/main.cpp index eed7397..bebeed1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,6 @@ #include "common/Inventory.h" #include "common/Item.h" #include "common/Spell.h" -#include "geometry/Point.h" #include "geometry/Vector.h" #include "graphics/ComplexAnimation.h" #include "graphics/Font.h" @@ -48,7 +47,6 @@ using common::Ikari; using common::Inventory; using common::Item; using common::Spell; -using geometry::Point; using geometry::Vector; using graphics::ComplexAnimation; using graphics::Font; @@ -82,15 +80,15 @@ int main(int argc, char **argv) { // temporary test data SDL_Surface *bg(IMG_Load("test-data/battle-bg.png")); PartyLayout monstersLayout; - monstersLayout.AddPosition(Point(88, 88)); - monstersLayout.AddPosition(Point(128, 88)); - monstersLayout.AddPosition(Point(168, 88)); - monstersLayout.AddPosition(Point(208, 88)); + monstersLayout.AddPosition(Vector(88, 88)); + monstersLayout.AddPosition(Vector(128, 88)); + monstersLayout.AddPosition(Vector(168, 88)); + monstersLayout.AddPosition(Vector(208, 88)); PartyLayout heroesLayout; - heroesLayout.AddPosition(Point(48, 136)); - heroesLayout.AddPosition(Point(128, 136)); - heroesLayout.AddPosition(Point(80, 152)); - heroesLayout.AddPosition(Point(160, 152)); + heroesLayout.AddPosition(Vector(48, 136)); + heroesLayout.AddPosition(Vector(128, 136)); + heroesLayout.AddPosition(Vector(80, 152)); + heroesLayout.AddPosition(Vector(160, 152)); SDL_Surface *monsterImg(IMG_Load("test-data/monster.png")); Sprite monsterSprite(monsterImg, 64, 64);