From a3ba4dc677ad7c92eeb78b20b642241563605c9d Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 27 Dec 2012 07:51:50 +0100 Subject: [PATCH] renamed namespace geometry -> math --- l2e.cbp | 4 ++-- src/battle/AttackTypeMenu.cpp | 6 +++--- src/battle/AttackTypeMenu.h | 8 +++---- src/battle/BattleState.cpp | 2 +- src/battle/BattleState.h | 26 +++++++++++------------ src/battle/Capsule.h | 8 +++---- src/battle/Hero.h | 8 +++---- src/battle/HeroTag.cpp | 4 ++-- src/battle/HeroTag.h | 6 +++--- src/battle/Monster.h | 8 +++---- src/battle/MoveMenu.cpp | 6 +++--- src/battle/MoveMenu.h | 4 ++-- src/battle/NumberAnimation.cpp | 4 ++-- src/battle/NumberAnimation.h | 4 ++-- src/battle/PartyLayout.cpp | 2 +- src/battle/PartyLayout.h | 12 +++++------ src/battle/SmallHeroTag.cpp | 6 +++--- src/battle/SmallHeroTag.h | 4 ++-- src/battle/states/PerformAttacks.cpp | 4 ++-- src/battle/states/PerformAttacks.h | 10 ++++----- src/battle/states/RunState.cpp | 4 ++-- src/battle/states/RunState.h | 4 ++-- src/battle/states/SelectAttackType.cpp | 2 +- src/battle/states/SelectAttackType.h | 4 ++-- src/battle/states/SelectIkari.cpp | 2 +- src/battle/states/SelectIkari.h | 8 +++---- src/battle/states/SelectItem.cpp | 2 +- src/battle/states/SelectItem.h | 8 +++---- src/battle/states/SelectMoveAction.cpp | 2 +- src/battle/states/SelectMoveAction.h | 4 ++-- src/battle/states/SelectSpell.cpp | 2 +- src/battle/states/SelectSpell.h | 8 +++---- src/battle/states/SelectTarget.cpp | 4 ++-- src/battle/states/SelectTarget.h | 4 ++-- src/battle/states/SwapHeroes.cpp | 4 ++-- src/battle/states/SwapHeroes.h | 4 ++-- src/common/Capsule.h | 6 +++--- src/common/ScriptRunner.cpp | 2 +- src/common/ScriptRunner.h | 8 +++---- src/geometry/fwd.h | 11 ---------- src/graphics/Animation.cpp | 12 +++++------ src/graphics/Animation.h | 12 +++++------ src/graphics/Camera.cpp | 2 +- src/graphics/Camera.h | 10 ++++----- src/graphics/CharSelect.cpp | 2 +- src/graphics/CharSelect.h | 4 ++-- src/graphics/ComplexAnimation.cpp | 2 +- src/graphics/ComplexAnimation.h | 6 +++--- src/graphics/Font.cpp | 2 +- src/graphics/Font.h | 14 ++++++------- src/graphics/Frame.cpp | 2 +- src/graphics/Frame.h | 20 +++++++++--------- src/graphics/Gauge.cpp | 2 +- src/graphics/Gauge.h | 12 +++++------ src/graphics/Menu.h | 28 ++++++++++++------------- src/graphics/Sprite.cpp | 2 +- src/graphics/Sprite.h | 24 ++++++++++----------- src/graphics/Texture.cpp | 2 +- src/graphics/Texture.h | 16 +++++++------- src/loader/Interpreter.cpp | 2 +- src/loader/Interpreter.h | 2 +- src/main.cpp | 4 ++-- src/map/Area.cpp | 6 +++--- src/map/Area.h | 12 +++++------ src/map/Entity.cpp | 4 ++-- src/map/Entity.h | 28 ++++++++++++------------- src/map/Map.cpp | 6 +++--- src/map/Map.h | 20 +++++++++--------- src/map/MapState.cpp | 2 +- src/map/MapState.h | 8 +++---- src/map/Tile.h | 8 +++---- src/map/TransitionState.cpp | 2 +- src/map/TransitionState.h | 6 +++--- src/map/Trigger.h | 8 +++---- src/{geometry => math}/Vector.h | 6 +++--- src/math/fwd.h | 11 ++++++++++ src/menu/CapsuleChangeMenu.cpp | 2 +- src/menu/CapsuleChangeMenu.h | 4 ++-- src/menu/CapsuleFeedMenu.cpp | 2 +- src/menu/CapsuleFeedMenu.h | 14 ++++++------- src/menu/CapsuleMenu.cpp | 4 ++-- src/menu/CapsuleMenu.h | 14 ++++++------- src/menu/CapsuleNameMenu.cpp | 2 +- src/menu/CapsuleNameMenu.h | 6 +++--- src/menu/ChangeHero.cpp | 2 +- src/menu/ChangeHero.h | 4 ++-- src/menu/ConfigMenu.cpp | 6 +++--- src/menu/ConfigMenu.h | 6 +++--- src/menu/EquipMenu.cpp | 2 +- src/menu/EquipMenu.h | 14 ++++++------- src/menu/HeroStatus.cpp | 2 +- src/menu/HeroStatus.h | 6 +++--- src/menu/InventoryMenu.cpp | 2 +- src/menu/InventoryMenu.h | 6 +++--- src/menu/PartyMenu.cpp | 4 ++-- src/menu/PartyMenu.h | 12 +++++------ src/menu/ScenarioMenu.cpp | 6 +++--- src/menu/ScenarioMenu.h | 6 +++--- src/menu/SelectHero.cpp | 4 ++-- src/menu/SpellMenu.cpp | 2 +- src/menu/SpellMenu.h | 8 +++---- src/menu/StatusMenu.cpp | 10 ++++----- src/menu/StatusMenu.h | 20 +++++++++--------- src/sdl/utility.cpp | 4 ++-- src/sdl/utility.h | 8 +++---- tests/{geometry => math}/VectorTest.cpp | 6 +++--- tests/{geometry => math}/VectorTest.h | 8 +++---- 107 files changed, 367 insertions(+), 367 deletions(-) delete mode 100644 src/geometry/fwd.h rename src/{geometry => math}/Vector.h (98%) create mode 100644 src/math/fwd.h rename tests/{geometry => math}/VectorTest.cpp (96%) rename tests/{geometry => math}/VectorTest.h (76%) diff --git a/l2e.cbp b/l2e.cbp index 4ff8392..7329d8a 100644 --- a/l2e.cbp +++ b/l2e.cbp @@ -133,8 +133,6 @@ - - @@ -194,6 +192,8 @@ + + diff --git a/src/battle/AttackTypeMenu.cpp b/src/battle/AttackTypeMenu.cpp index 16bda25..952bf81 100644 --- a/src/battle/AttackTypeMenu.cpp +++ b/src/battle/AttackTypeMenu.cpp @@ -1,13 +1,13 @@ #include "AttackTypeMenu.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" -using geometry::Vector; +using math::Vector; namespace battle { -void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Vector &position) { +void AttackTypeMenu::Render(SDL_Surface *screen, const math::Vector &position) { const Vector &swordOffset(IconSize()); const Vector magicOffset(IconWidth(), 0); const Vector defendOffset(2 * IconWidth(), IconHeight()); diff --git a/src/battle/AttackTypeMenu.h b/src/battle/AttackTypeMenu.h index aa5f9c5..6d32daf 100644 --- a/src/battle/AttackTypeMenu.h +++ b/src/battle/AttackTypeMenu.h @@ -2,7 +2,7 @@ #define BATTLE_ATTACKTYPEMENU_H_ #include "AttackChoice.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" #include @@ -18,14 +18,14 @@ public: public: void Select(AttackChoice::Type t) { selected = t; } AttackChoice::Type Selected() const { return selected; } - void Render(SDL_Surface *screen, const geometry::Vector &position); + void Render(SDL_Surface *screen, const math::Vector &position); int Width() const { return 3 * IconWidth(); } int Height() const { return 3 * IconHeight(); } - geometry::Vector Size() const { return 3 * IconSize(); } + math::Vector Size() const { return 3 * IconSize(); } int IconWidth() const { return icons->Width(); } int IconHeight() const { return icons->Height(); } - const geometry::Vector &IconSize() const { return icons->Size(); } + const math::Vector &IconSize() const { return icons->Size(); } private: const graphics::Sprite *icons; diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 085a853..8218c10 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -24,7 +24,7 @@ using common::Inventory; using common::Item; using common::Spell; using common::Stats; -using geometry::Vector; +using math::Vector; using graphics::Menu; using std::rand; diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index 1c994e4..5258895 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -15,7 +15,7 @@ #include "../common/GameConfig.h" #include "../common/fwd.h" #include "../common/Stats.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Animation.h" #include "../graphics/fwd.h" #include "../graphics/Menu.h" @@ -76,7 +76,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::Vector &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; } + const math::Vector &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; } Capsule &GetCapsule() { return capsule; } @@ -122,21 +122,21 @@ public: bool Defeat() const; public: - geometry::Vector CalculateScreenOffset(SDL_Surface *screen) const { - return geometry::Vector( + math::Vector CalculateScreenOffset(SDL_Surface *screen) const { + return math::Vector( (screen->w - background->w) / 2, (screen->h - background->h) / 2); } int Width() const { return background->w; } int Height() const { return background->h; } - geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } + math::Vector Size() const { return math::Vector(Width(), Height()); } - void RenderBackground(SDL_Surface *screen, const geometry::Vector &offset); - void RenderMonsters(SDL_Surface *screen, const geometry::Vector &offset); - void RenderHeroes(SDL_Surface *screen, const geometry::Vector &offset); - void RenderCapsule(SDL_Surface *screen, const geometry::Vector &offset); - void RenderHeroTags(SDL_Surface *screen, const geometry::Vector &offset); - void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector &offset); + void RenderBackground(SDL_Surface *screen, const math::Vector &offset); + void RenderMonsters(SDL_Surface *screen, const math::Vector &offset); + void RenderHeroes(SDL_Surface *screen, const math::Vector &offset); + void RenderCapsule(SDL_Surface *screen, const math::Vector &offset); + void RenderHeroTags(SDL_Surface *screen, const math::Vector &offset); + void RenderSmallHeroTags(SDL_Surface *screen, const math::Vector &offset); private: virtual void OnEnterState(SDL_Surface *screen); @@ -168,8 +168,8 @@ private: graphics::Menu itemMenu; HeroTag heroTags[4]; SmallHeroTag smallHeroTags[4]; - geometry::Vector heroTagPositions[4]; - geometry::Vector smallHeroTagPositions[4]; + math::Vector heroTagPositions[4]; + math::Vector smallHeroTagPositions[4]; Capsule capsule; int numHeroes; int activeHero; diff --git a/src/battle/Capsule.h b/src/battle/Capsule.h index 7438492..8f268e1 100644 --- a/src/battle/Capsule.h +++ b/src/battle/Capsule.h @@ -7,7 +7,7 @@ namespace common { #include "AttackChoice.h" #include "../common/Stats.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Animation.h" #include "../graphics/fwd.h" #include "../graphics/Menu.h" @@ -42,8 +42,8 @@ public: const graphics::Animation *AttackAnimation() const; const graphics::Animation *SpellAnimation() const; - geometry::Vector &Position() { return position; } - const geometry::Vector &Position() const { return position; } + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } AttackChoice &GetAttackChoice() { return attackChoice; } const AttackChoice &GetAttackChoice() const { return attackChoice; } @@ -54,7 +54,7 @@ private: int health; graphics::AnimationRunner animation; - geometry::Vector position; + math::Vector position; AttackChoice attackChoice; common::Stats stats; diff --git a/src/battle/Hero.h b/src/battle/Hero.h index bf02f03..da2c866 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -6,7 +6,7 @@ #include "../common/fwd.h" #include "../common/Hero.h" #include "../common/Stats.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Animation.h" #include "../graphics/fwd.h" #include "../graphics/Menu.h" @@ -69,8 +69,8 @@ public: const graphics::Animation *AttackAnimation() const { return master->AttackAnimation(); } const graphics::Animation *SpellAnimation() const { return master->SpellAnimation(); } - geometry::Vector &Position() { return position; } - const geometry::Vector &Position() const { return position; } + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } graphics::Menu &SpellMenu() { return spellMenu; } const graphics::Menu &SpellMenu() const { return spellMenu; } @@ -89,7 +89,7 @@ private: graphics::AnimationRunner animation; - geometry::Vector position; + math::Vector position; graphics::Menu spellMenu; graphics::Menu ikariMenu; diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 7c8769a..6dc5e86 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -4,13 +4,13 @@ #include "BattleState.h" #include "Hero.h" #include "Resources.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Gauge.h" #include "../graphics/Sprite.h" -using geometry::Vector; +using math::Vector; using graphics::Frame; namespace battle { diff --git a/src/battle/HeroTag.h b/src/battle/HeroTag.h index ddade4d..24c8f8a 100644 --- a/src/battle/HeroTag.h +++ b/src/battle/HeroTag.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "Hero.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/fwd.h" #include @@ -19,9 +19,9 @@ public: public: const graphics::Sprite *HeroSprite() const; - geometry::Vector HeroOffset() const; + math::Vector HeroOffset() const; - void Render(SDL_Surface *screen, int width, int height, const geometry::Vector &position, bool active) const; + void Render(SDL_Surface *screen, int width, int height, const math::Vector &position, bool active) const; private: const BattleState *battle; diff --git a/src/battle/Monster.h b/src/battle/Monster.h index 8d68085..bb44bb4 100644 --- a/src/battle/Monster.h +++ b/src/battle/Monster.h @@ -4,7 +4,7 @@ #include "AttackChoice.h" #include "../common/fwd.h" #include "../common/Stats.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Animation.h" #include "../graphics/fwd.h" @@ -55,8 +55,8 @@ public: const graphics::Animation *AttackAnimation() const { return attackAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } - geometry::Vector &Position() { return position; } - const geometry::Vector &Position() const { return position; } + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } // temporary setters until loader is implemented public: @@ -93,7 +93,7 @@ private: graphics::AnimationRunner animation; - geometry::Vector position; + math::Vector position; AttackChoice attackChoice; diff --git a/src/battle/MoveMenu.cpp b/src/battle/MoveMenu.cpp index 1b49f01..acbce64 100644 --- a/src/battle/MoveMenu.cpp +++ b/src/battle/MoveMenu.cpp @@ -1,13 +1,13 @@ #include "MoveMenu.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" -using geometry::Vector; +using math::Vector; namespace battle { -void MoveMenu::Render(SDL_Surface *screen, const geometry::Vector &position) { +void MoveMenu::Render(SDL_Surface *screen, const math::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 2a9ee7c..6a177ef 100644 --- a/src/battle/MoveMenu.h +++ b/src/battle/MoveMenu.h @@ -1,7 +1,7 @@ #ifndef BATTLE_MOVEMENU_H_ #define BATTLE_MOVEMENU_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" namespace battle { @@ -23,7 +23,7 @@ public: public: void Select(Icon i) { selected = i; } Icon Selected() const { return selected; } - void Render(SDL_Surface *screen, const geometry::Vector &position); + void Render(SDL_Surface *screen, const math::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 63d1656..e3b27ba 100644 --- a/src/battle/NumberAnimation.cpp +++ b/src/battle/NumberAnimation.cpp @@ -1,10 +1,10 @@ #include "NumberAnimation.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" using app::State; -using geometry::Vector; +using math::Vector; using graphics::Animation; using graphics::AnimationRunner; using graphics::Sprite; diff --git a/src/battle/NumberAnimation.h b/src/battle/NumberAnimation.h index 16208dd..dea8bfc 100644 --- a/src/battle/NumberAnimation.h +++ b/src/battle/NumberAnimation.h @@ -2,7 +2,7 @@ #define BATTLE_NUMBERANIMATION_H_ #include "../app/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Animation.h" namespace battle { @@ -21,7 +21,7 @@ public: int Width() const; int Height() const; - void Draw(SDL_Surface *dest, const geometry::Vector &position) const; + void Draw(SDL_Surface *dest, const math::Vector &position) const; private: int number; diff --git a/src/battle/PartyLayout.cpp b/src/battle/PartyLayout.cpp index bf8b3e8..e46b276 100644 --- a/src/battle/PartyLayout.cpp +++ b/src/battle/PartyLayout.cpp @@ -3,7 +3,7 @@ #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/battle/PartyLayout.h b/src/battle/PartyLayout.h index f5cd03d..ec12f4d 100644 --- a/src/battle/PartyLayout.h +++ b/src/battle/PartyLayout.h @@ -1,7 +1,7 @@ #ifndef BATTLE_PARTYLAYOUT_H_ #define BATTLE_PARTYLAYOUT_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include #include @@ -18,12 +18,12 @@ public: PartyLayout() : positions(0), numPositions(0) { } public: - std::vector >::size_type NumPositions() const { return numPositions; } - void CalculatePositions(int width, int height, std::vector > &dest) const; - geometry::Vector CalculatePosition(int index, int width, int height) const; + std::vector >::size_type NumPositions() const { return numPositions; } + void CalculatePositions(int width, int height, std::vector > &dest) const; + math::Vector CalculatePosition(int index, int width, int height) const; public: - void SetPositions(const geometry::Vector *p, int num) { + void SetPositions(const math::Vector *p, int num) { positions = p; numPositions = num; } @@ -32,7 +32,7 @@ public: static void Construct(void *); private: - const geometry::Vector *positions; + const math::Vector *positions; int numPositions; }; diff --git a/src/battle/SmallHeroTag.cpp b/src/battle/SmallHeroTag.cpp index 265f230..1496d47 100644 --- a/src/battle/SmallHeroTag.cpp +++ b/src/battle/SmallHeroTag.cpp @@ -1,19 +1,19 @@ #include "SmallHeroTag.h" #include "BattleState.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Gauge.h" -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; using graphics::Sprite; namespace battle { -void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, const geometry::Vector &position) const { +void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, const math::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 69a6f5c..7c03801 100644 --- a/src/battle/SmallHeroTag.h +++ b/src/battle/SmallHeroTag.h @@ -2,7 +2,7 @@ #define BATTLE_SMALLHEROTAG_H_ #include "fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/fwd.h" #include @@ -16,7 +16,7 @@ public: SmallHeroTag(const BattleState *battle, int heroIndex) : battle(battle), index(heroIndex) { } - void Render(SDL_Surface *screen, int width, int height, const geometry::Vector &position) const; + void Render(SDL_Surface *screen, int width, int height, const math::Vector &position) const; private: const BattleState *battle; diff --git a/src/battle/states/PerformAttacks.cpp b/src/battle/states/PerformAttacks.cpp index 43414eb..f930de9 100644 --- a/src/battle/states/PerformAttacks.cpp +++ b/src/battle/states/PerformAttacks.cpp @@ -24,7 +24,7 @@ using app::Application; using app::Input; -using geometry::Vector; +using math::Vector; using graphics::AnimationRunner; using std::vector; @@ -254,7 +254,7 @@ void PerformAttacks::RenderNumbers(SDL_Surface *screen, const Vector &offse } } -void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector &offset) const { +void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const math::Vector &offset) const { if (!targetAnimation.Valid() || !targetAnimation.Running()) return; const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection()); if (ts.TargetsHeroes()) { diff --git a/src/battle/states/PerformAttacks.h b/src/battle/states/PerformAttacks.h index b862369..de20f76 100644 --- a/src/battle/states/PerformAttacks.h +++ b/src/battle/states/PerformAttacks.h @@ -11,7 +11,7 @@ #include "../../app/State.h" #include "../NumberAnimation.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" #include "../../graphics/Animation.h" #include @@ -49,9 +49,9 @@ private: private: void AddNumberAnimations(const TargetSelection &); - void RenderTitleBar(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderNumbers(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderTitleBar(SDL_Surface *screen, const math::Vector &offset) const; + void RenderNumbers(SDL_Surface *screen, const math::Vector &offset) const; + void RenderTargetAnimation(SDL_Surface *screen, const math::Vector &offset) const; private: BattleState *battle; @@ -61,7 +61,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 311e0f3..afbbe53 100644 --- a/src/battle/states/RunState.cpp +++ b/src/battle/states/RunState.cpp @@ -10,7 +10,7 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" #include "../../graphics/Font.h" #include "../../graphics/Frame.h" @@ -18,7 +18,7 @@ using app::Application; using app::Input; -using geometry::Vector; +using math::Vector; namespace battle { diff --git a/src/battle/states/RunState.h b/src/battle/states/RunState.h index cf91f9a..cdf7881 100644 --- a/src/battle/states/RunState.h +++ b/src/battle/states/RunState.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -36,7 +36,7 @@ private: virtual void OnResize(int width, int height); private: - void RenderTitleBar(SDL_Surface *screen, const geometry::Vector &offset); + void RenderTitleBar(SDL_Surface *screen, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectAttackType.cpp b/src/battle/states/SelectAttackType.cpp index fade232..9f6e561 100644 --- a/src/battle/states/SelectAttackType.cpp +++ b/src/battle/states/SelectAttackType.cpp @@ -23,7 +23,7 @@ using app::Application; using app::Input; using common::Item; -using geometry::Vector; +using math::Vector; namespace battle { diff --git a/src/battle/states/SelectAttackType.h b/src/battle/states/SelectAttackType.h index 64a7dbd..c096fa0 100644 --- a/src/battle/states/SelectAttackType.h +++ b/src/battle/states/SelectAttackType.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -35,7 +35,7 @@ private: virtual void OnResize(int width, int height); private: - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset); + void RenderMenu(SDL_Surface *screen, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectIkari.cpp b/src/battle/states/SelectIkari.cpp index 2860a81..4bfea03 100644 --- a/src/battle/states/SelectIkari.cpp +++ b/src/battle/states/SelectIkari.cpp @@ -19,7 +19,7 @@ using app::Application; using app::Input; using common::Ikari; -using geometry::Vector; +using math::Vector; using graphics::Frame; namespace battle { diff --git a/src/battle/states/SelectIkari.h b/src/battle/states/SelectIkari.h index 8603a57..ca08732 100644 --- a/src/battle/states/SelectIkari.h +++ b/src/battle/states/SelectIkari.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -36,9 +36,9 @@ private: virtual void OnResize(int width, int height); private: - void RenderFrame(SDL_Surface *, const geometry::Vector &offset); - void RenderHeadline(SDL_Surface *, const geometry::Vector &offset); - void RenderMenu(SDL_Surface *, const geometry::Vector &offset); + void RenderFrame(SDL_Surface *, const math::Vector &offset); + void RenderHeadline(SDL_Surface *, const math::Vector &offset); + void RenderMenu(SDL_Surface *, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectItem.cpp b/src/battle/states/SelectItem.cpp index 6ca4396..b643116 100644 --- a/src/battle/states/SelectItem.cpp +++ b/src/battle/states/SelectItem.cpp @@ -18,7 +18,7 @@ using app::Application; using app::Input; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Frame; namespace battle { diff --git a/src/battle/states/SelectItem.h b/src/battle/states/SelectItem.h index 1942ff4..97863e2 100644 --- a/src/battle/states/SelectItem.h +++ b/src/battle/states/SelectItem.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -35,9 +35,9 @@ private: virtual void OnResize(int width, int height); private: - void RenderFrame(SDL_Surface *, const geometry::Vector &offset); - void RenderHeadline(SDL_Surface *, const geometry::Vector &offset); - void RenderMenu(SDL_Surface *, const geometry::Vector &offset); + void RenderFrame(SDL_Surface *, const math::Vector &offset); + void RenderHeadline(SDL_Surface *, const math::Vector &offset); + void RenderMenu(SDL_Surface *, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index 52b670b..74e8628 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -17,7 +17,7 @@ using app::Application; using app::Input; -using geometry::Vector; +using math::Vector; namespace battle { diff --git a/src/battle/states/SelectMoveAction.h b/src/battle/states/SelectMoveAction.h index a48633d..069f98d 100644 --- a/src/battle/states/SelectMoveAction.h +++ b/src/battle/states/SelectMoveAction.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -35,7 +35,7 @@ private: virtual void OnResize(int width, int height); private: - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset); + void RenderMenu(SDL_Surface *screen, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectSpell.cpp b/src/battle/states/SelectSpell.cpp index d7941c8..e15fa2e 100644 --- a/src/battle/states/SelectSpell.cpp +++ b/src/battle/states/SelectSpell.cpp @@ -19,7 +19,7 @@ using app::Application; using app::Input; using common::Spell; -using geometry::Vector; +using math::Vector; using graphics::Frame; namespace battle { diff --git a/src/battle/states/SelectSpell.h b/src/battle/states/SelectSpell.h index 514a2b8..93734a3 100644 --- a/src/battle/states/SelectSpell.h +++ b/src/battle/states/SelectSpell.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -35,9 +35,9 @@ private: virtual void OnResize(int width, int height); private: - void RenderFrame(SDL_Surface *, const geometry::Vector &offset); - void RenderHeadline(SDL_Surface *, const geometry::Vector &offset); - void RenderMenu(SDL_Surface *, const geometry::Vector &offset); + void RenderFrame(SDL_Surface *, const math::Vector &offset); + void RenderHeadline(SDL_Surface *, const math::Vector &offset); + void RenderMenu(SDL_Surface *, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SelectTarget.cpp b/src/battle/states/SelectTarget.cpp index 1961738..1644c2e 100644 --- a/src/battle/states/SelectTarget.cpp +++ b/src/battle/states/SelectTarget.cpp @@ -14,7 +14,7 @@ using app::Application; using app::Input; -using geometry::Vector; +using math::Vector; using std::vector; namespace battle { @@ -85,7 +85,7 @@ void SelectTarget::Render(SDL_Surface *screen) { RenderCursors(screen, offset); } -void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector &offset) { +void SelectTarget::RenderCursors(SDL_Surface *screen, const math::Vector &offset) { 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)); diff --git a/src/battle/states/SelectTarget.h b/src/battle/states/SelectTarget.h index 388aef3..542e0e4 100644 --- a/src/battle/states/SelectTarget.h +++ b/src/battle/states/SelectTarget.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" #include "../../graphics/fwd.h" namespace battle { @@ -36,7 +36,7 @@ private: virtual void OnResize(int width, int height); private: - void RenderCursors(SDL_Surface *screen, const geometry::Vector &offset); + void RenderCursors(SDL_Surface *screen, const math::Vector &offset); private: BattleState *battle; diff --git a/src/battle/states/SwapHeroes.cpp b/src/battle/states/SwapHeroes.cpp index 357e324..9bde2b3 100644 --- a/src/battle/states/SwapHeroes.cpp +++ b/src/battle/states/SwapHeroes.cpp @@ -14,7 +14,7 @@ using app::Application; using app::Input; -using geometry::Vector; +using math::Vector; using std::vector; namespace battle { @@ -120,7 +120,7 @@ void SwapHeroes::Render(SDL_Surface *screen) { RenderCursors(screen, offset); } -void SwapHeroes::RenderCursors(SDL_Surface *screen, const geometry::Vector &offset) { +void SwapHeroes::RenderCursors(SDL_Surface *screen, const math::Vector &offset) { // 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); diff --git a/src/battle/states/SwapHeroes.h b/src/battle/states/SwapHeroes.h index 198e4d3..14d0d72 100644 --- a/src/battle/states/SwapHeroes.h +++ b/src/battle/states/SwapHeroes.h @@ -10,7 +10,7 @@ #include "../fwd.h" #include "../../app/State.h" -#include "../../geometry/Vector.h" +#include "../../math/Vector.h" namespace battle { @@ -41,7 +41,7 @@ private: void MoveLeft(); private: - void RenderCursors(SDL_Surface *screen, const geometry::Vector &offset); + void RenderCursors(SDL_Surface *screen, const math::Vector &offset); private: BattleState *battle; diff --git a/src/common/Capsule.h b/src/common/Capsule.h index bf99cfa..d54394f 100644 --- a/src/common/Capsule.h +++ b/src/common/Capsule.h @@ -10,7 +10,7 @@ namespace graphics { } #include "../common/Stats.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -39,7 +39,7 @@ public: int MaxClass() const { return maxClass; } int CurrentClass() const { return curClass; } - const geometry::Vector &AlignmentOffset() const { return alignmentCursor; } + const math::Vector &AlignmentOffset() const { return alignmentCursor; } const graphics::Sprite *AlignmentSprite() const { return alignmentSprite; } void UpgradeClass(); @@ -106,7 +106,7 @@ private: const char *name; const char *alignment; - geometry::Vector alignmentCursor; + math::Vector alignmentCursor; const graphics::Sprite *alignmentSprite; int maxHealth; diff --git a/src/common/ScriptRunner.cpp b/src/common/ScriptRunner.cpp index 8f1ad2a..947ded7 100644 --- a/src/common/ScriptRunner.cpp +++ b/src/common/ScriptRunner.cpp @@ -5,7 +5,7 @@ #include -using geometry::Vector; +using math::Vector; namespace common { diff --git a/src/common/ScriptRunner.h b/src/common/ScriptRunner.h index 7a8aa2c..67931c1 100644 --- a/src/common/ScriptRunner.h +++ b/src/common/ScriptRunner.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "Script.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -21,7 +21,7 @@ public: void *AddressRegister(int n) const { return address[n]; } int IntegerRegister(int n) const { return integer[n]; } - const geometry::Vector &VectorRegister(int n) const { return vector[n]; } + const math::Vector &VectorRegister(int n) const { return vector[n]; } private: void Reset(); @@ -30,7 +30,7 @@ private: void *PopAddress(); Script::Code PopCode(); int PopInt(); - const geometry::Vector &PopVector(); + const math::Vector &PopVector(); void Compare(int, int); @@ -48,7 +48,7 @@ private: static const int numRegisters = 7; void *address[numRegisters]; int integer[numRegisters]; - geometry::Vector vector[numRegisters]; + math::Vector vector[numRegisters]; Uint8 compare; diff --git a/src/geometry/fwd.h b/src/geometry/fwd.h deleted file mode 100644 index d8fa4a0..0000000 --- a/src/geometry/fwd.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef GEOMERTY_FWD_H_ -#define GEOMERTY_FWD_H_ - -namespace geometry { - -template -class Vector; - -} - -#endif /* GEOMERTY_FWD_H_ */ diff --git a/src/graphics/Animation.cpp b/src/graphics/Animation.cpp index f55a9aa..602d7ef 100644 --- a/src/graphics/Animation.cpp +++ b/src/graphics/Animation.cpp @@ -63,24 +63,24 @@ bool AnimationRunner::JustFinished() const { } -void AnimationRunner::Draw(SDL_Surface *dest, geometry::Vector position) const { +void AnimationRunner::Draw(SDL_Surface *dest, math::Vector position) const { GetSprite()->Draw(dest, position + animation->Offset(Frame()), animation->Col(Frame()) + ColOffset(), animation->Row(Frame()) + RowOffset()); } -void AnimationRunner::DrawTopRight(SDL_Surface *dest, geometry::Vector position) const { - geometry::Vector offset(-GetSprite()->Width(), 0); +void AnimationRunner::DrawTopRight(SDL_Surface *dest, math::Vector position) const { + math::Vector offset(-GetSprite()->Width(), 0); Draw(dest, position + offset); } -void AnimationRunner::DrawCenter(SDL_Surface *dest, geometry::Vector position) const { +void AnimationRunner::DrawCenter(SDL_Surface *dest, math::Vector position) const { Draw(dest, position - (GetSprite()->Size() / 2)); } -void AnimationRunner::DrawCenterBottom(SDL_Surface *dest, geometry::Vector position) const { - geometry::Vector offset(-GetSprite()->Width() / 2, -GetSprite()->Height()); +void AnimationRunner::DrawCenterBottom(SDL_Surface *dest, math::Vector position) const { + math::Vector offset(-GetSprite()->Width() / 2, -GetSprite()->Height()); Draw(dest, position + offset); } diff --git a/src/graphics/Animation.h b/src/graphics/Animation.h index 79bfa85..f70379d 100644 --- a/src/graphics/Animation.h +++ b/src/graphics/Animation.h @@ -10,7 +10,7 @@ namespace loader { } #include "../app/Timer.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include #include @@ -45,7 +45,7 @@ public: virtual int NumFrames() const = 0; virtual int Col(int frame) const = 0; virtual int Row(int frame) const = 0; - virtual geometry::Vector Offset(int frame) const { return geometry::Vector(); } + virtual math::Vector Offset(int frame) const { return math::Vector(); } static void CreateTypeDescription(); @@ -93,10 +93,10 @@ public: void ChangeSprite(const Sprite *s) { sprite = s; } const Sprite *GetSprite() const { return sprite ? sprite : animation->GetSprite(); } - void Draw(SDL_Surface *dest, geometry::Vector position) const; - void DrawTopRight(SDL_Surface *dest, geometry::Vector position) const; - void DrawCenter(SDL_Surface *dest, geometry::Vector position) const; - void DrawCenterBottom(SDL_Surface *dest, geometry::Vector position) const; + void Draw(SDL_Surface *dest, math::Vector position) const; + void DrawTopRight(SDL_Surface *dest, math::Vector position) const; + void DrawCenter(SDL_Surface *dest, math::Vector position) const; + void DrawCenterBottom(SDL_Surface *dest, math::Vector position) const; int Frame() const; diff --git a/src/graphics/Camera.cpp b/src/graphics/Camera.cpp index 6039586..ee87e3f 100644 --- a/src/graphics/Camera.cpp +++ b/src/graphics/Camera.cpp @@ -2,7 +2,7 @@ #include -using geometry::Vector; +using math::Vector; namespace graphics { diff --git a/src/graphics/Camera.h b/src/graphics/Camera.h index 49d0e46..6067bab 100644 --- a/src/graphics/Camera.h +++ b/src/graphics/Camera.h @@ -1,24 +1,24 @@ #ifndef GRAPHICS_CAMERA_H_ #define GRAPHICS_CAMERA_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" namespace graphics { class Camera { public: - Camera(int width, int height, const geometry::Vector *target); + Camera(int width, int height, const math::Vector *target); ~Camera() { } public: void Resize(int w, int h) { halfWidth = w / 2; halfHeight = h / 2; } - void SetTarget(const geometry::Vector *t); + void SetTarget(const math::Vector *t); - geometry::Vector CalculateOffset() const; + math::Vector CalculateOffset() const; private: - const geometry::Vector *target; + const math::Vector *target; int halfWidth; int halfHeight; diff --git a/src/graphics/CharSelect.cpp b/src/graphics/CharSelect.cpp index 415c7a6..a07563b 100644 --- a/src/graphics/CharSelect.cpp +++ b/src/graphics/CharSelect.cpp @@ -7,7 +7,7 @@ #include -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/CharSelect.h b/src/graphics/CharSelect.h index c5d4cd8..6859dfe 100644 --- a/src/graphics/CharSelect.h +++ b/src/graphics/CharSelect.h @@ -1,7 +1,7 @@ #ifndef GRAPHICS_CHARSELECT_H_ #define GRAPHICS_CHARSELECT_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -18,7 +18,7 @@ public: static const int TYPE_ID = 411; public: - void Draw(SDL_Surface *screen, const geometry::Vector &position) const; + void Draw(SDL_Surface *screen, const math::Vector &position) const; void NextCol(); void PreviousCol(); diff --git a/src/graphics/ComplexAnimation.cpp b/src/graphics/ComplexAnimation.cpp index bd2eaf8..c1b88c1 100644 --- a/src/graphics/ComplexAnimation.cpp +++ b/src/graphics/ComplexAnimation.cpp @@ -3,7 +3,7 @@ #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/ComplexAnimation.h b/src/graphics/ComplexAnimation.h index eeeef68..1ed001a 100644 --- a/src/graphics/ComplexAnimation.h +++ b/src/graphics/ComplexAnimation.h @@ -19,11 +19,11 @@ public: struct FrameProp { static const int TYPE_ID = 403; FrameProp() : col(0), row(0) { } - FrameProp(int col, int row, const geometry::Vector &disposition) + FrameProp(int col, int row, const math::Vector &disposition) : col(col), row(row), disposition(disposition) {} int col; int row; - geometry::Vector disposition; + math::Vector disposition; }; void SetFrames(const FrameProp *f, int num) { frames = f; numFrames = num; } @@ -34,7 +34,7 @@ protected: virtual int NumFrames() const; virtual int Col(int frame) const; virtual int Row(int frame) const; - virtual geometry::Vector Offset(int frame) const; + virtual math::Vector Offset(int frame) const; private: const FrameProp *frames; diff --git a/src/graphics/Font.cpp b/src/graphics/Font.cpp index 069d032..9b41551 100644 --- a/src/graphics/Font.cpp +++ b/src/graphics/Font.cpp @@ -7,7 +7,7 @@ #include #include -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/Font.h b/src/graphics/Font.h index c879dce..272b09f 100644 --- a/src/graphics/Font.h +++ b/src/graphics/Font.h @@ -2,7 +2,7 @@ #define GRAPHICS_FONT_H_ #include "Sprite.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -25,12 +25,12 @@ public: int StringWidth(const char *) const; int StringHeight(const char *) 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 maxWidth = 0) const; - void DrawStringRight(const char *s, SDL_Surface *dest, const geometry::Vector &position, int maxWidth = 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; - void DrawNumberRight(int n, SDL_Surface *dest, const geometry::Vector &position, int digits = 0) const; + void DrawChar(char c, SDL_Surface *dest, const math::Vector &position) const; + void DrawString(const char *s, SDL_Surface *dest, const math::Vector &position, int maxWidth = 0) const; + void DrawStringRight(const char *s, SDL_Surface *dest, const math::Vector &position, int maxWidth = 0) const; + void DrawDigit(int d, SDL_Surface *dest, const math::Vector &position) const; + void DrawNumber(int n, SDL_Surface *dest, const math::Vector &position, int digits = 0) const; + void DrawNumberRight(int n, SDL_Surface *dest, const math::Vector &position, int digits = 0) const; public: void SetSprite(const Sprite *s) { sprite = s; } diff --git a/src/graphics/Frame.cpp b/src/graphics/Frame.cpp index dbfd814..f9d8825 100644 --- a/src/graphics/Frame.cpp +++ b/src/graphics/Frame.cpp @@ -4,7 +4,7 @@ #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/Frame.h b/src/graphics/Frame.h index 62c052d..023b694 100644 --- a/src/graphics/Frame.h +++ b/src/graphics/Frame.h @@ -1,7 +1,7 @@ #ifndef GRAPHICS_FRAME_H_ #define GRAPHICS_FRAME_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -21,26 +21,26 @@ public: int MinHeight() const { return 2 * BorderHeight(); } int BorderWidth() const { return BorderSize().X(); } int BorderHeight() const { return BorderSize().Y(); } - const geometry::Vector BorderSize() const { return borderSize; } + const math::Vector BorderSize() const { return borderSize; } int RepeatWidth() const { return RepeatSize().X(); } int RepeatHeight() const { return RepeatSize().Y(); } - const geometry::Vector RepeatSize() const { return repeatSize; } - void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, int height) const; + const math::Vector RepeatSize() const { return repeatSize; } + void Draw(SDL_Surface *dest, const math::Vector &position, int width, int height) const; public: void SetSurface(SDL_Surface *s) { surface = s; } - void SetBorderSize(const geometry::Vector &s) { borderSize = s; } - void SetRepeatSize(const geometry::Vector &s) { repeatSize = s; } - void SetOffset(const geometry::Vector &o) { offset = o; } + void SetBorderSize(const math::Vector &s) { borderSize = s; } + void SetRepeatSize(const math::Vector &s) { repeatSize = s; } + void SetOffset(const math::Vector &o) { offset = o; } static void CreateTypeDescription(); static void Construct(void *); private: SDL_Surface *surface; - geometry::Vector borderSize; - geometry::Vector repeatSize; - geometry::Vector offset; + math::Vector borderSize; + math::Vector repeatSize; + math::Vector offset; }; diff --git a/src/graphics/Gauge.cpp b/src/graphics/Gauge.cpp index 7e20567..d5b41b5 100644 --- a/src/graphics/Gauge.cpp +++ b/src/graphics/Gauge.cpp @@ -3,7 +3,7 @@ #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/Gauge.h b/src/graphics/Gauge.h index 59a7490..383559e 100644 --- a/src/graphics/Gauge.h +++ b/src/graphics/Gauge.h @@ -1,7 +1,7 @@ #ifndef GRAPHICS_GAUGE_H_ #define GRAPHICS_GAUGE_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -19,12 +19,12 @@ public: public: int MinWidth() const { return startWidth + endWidth; } int Height() const { return height; } - void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, Uint8 fill) const; + void Draw(SDL_Surface *dest, const math::Vector &position, int width, Uint8 fill) const; public: void SetSurface(SDL_Surface *s) { surface = s; } - void SetFullOffset(const geometry::Vector &o) { fullOffset = o; } - void SetEmptyOffset(const geometry::Vector &o) { emptyOffset = o; } + void SetFullOffset(const math::Vector &o) { fullOffset = o; } + void SetEmptyOffset(const math::Vector &o) { emptyOffset = o; } void SetHeight(int h) { height = h; } void SetStartWidth(int w) { startWidth = w; } void SetRepeatWidth(int w) { repeatWidth = w; } @@ -35,8 +35,8 @@ public: private: SDL_Surface *surface; - geometry::Vector fullOffset; - geometry::Vector emptyOffset; + math::Vector fullOffset; + math::Vector emptyOffset; int height; int startWidth; int repeatWidth; diff --git a/src/graphics/Menu.h b/src/graphics/Menu.h index d83b2a5..91cc3a7 100644 --- a/src/graphics/Menu.h +++ b/src/graphics/Menu.h @@ -4,7 +4,7 @@ #include "Font.h" #include "fwd.h" #include "Sprite.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include #include @@ -105,7 +105,7 @@ public: void Clear() { entries.clear(); } void ClearEntry(int at) { entries[at] = Entry(0, T(), false); } - void Draw(SDL_Surface *dest, const geometry::Vector &position) const; + void Draw(SDL_Surface *dest, const math::Vector &position) const; private: int GetRow(int index) const { return index / cols; } @@ -231,51 +231,51 @@ void Menu::SelectIndex(int index) { template -void Menu::Draw(SDL_Surface *dest, const geometry::Vector &position) const { +void Menu::Draw(SDL_Surface *dest, const math::Vector &position) const { int start(topRow * cols); int slots(rows * cols); int items(entries.size() - start); int end(start + (items < slots ? items : slots)); for (int i(0), count(end - start); i < count; ++i) { if (!entries[start + i].title) continue; - geometry::Vector iconOffset( + math::Vector iconOffset( (i % cols) * (ColWidth() + colGap), (i / cols) * RowHeight()); // This fixes the position of the third column of the inventory and capsule menus. if (thirdColumnHack && i % cols == 2) { - iconOffset += geometry::Vector(font->CharWidth() * thirdColumnHack, 0); + iconOffset += math::Vector(font->CharWidth() * thirdColumnHack, 0); } if (entries[start + i].icon) { entries[start + i].icon->Draw(dest, position + iconOffset); } - geometry::Vector textOffset(iconOffset.X() + iconSpace, iconOffset.Y()); + math::Vector textOffset(iconOffset.X() + iconSpace, iconOffset.Y()); const Font *usedFont(entries[start + i].enabled ? font : disabledFont); usedFont->DrawString(entries[start + i].title, dest, position + textOffset, charsPerEntry); - textOffset += geometry::Vector(charsPerEntry * usedFont->CharWidth(), 0); + textOffset += math::Vector(charsPerEntry * usedFont->CharWidth(), 0); if (charsPerAdditionalText) { - textOffset += geometry::Vector(additionalTextGap, 0); + textOffset += math::Vector(additionalTextGap, 0); if (entries[start + i].additionalText) { usedFont->DrawString(entries[start + i].additionalText, dest, position + textOffset, charsPerAdditionalText); } - textOffset += geometry::Vector(charsPerAdditionalText * usedFont->CharWidth(), 0); + textOffset += math::Vector(charsPerAdditionalText * usedFont->CharWidth(), 0); } if (charsPerNumber) { usedFont->DrawChar(delimiter, dest, position + textOffset); - textOffset += geometry::Vector(usedFont->CharWidth(), 0); + textOffset += math::Vector(usedFont->CharWidth(), 0); usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset, charsPerNumber); } } - geometry::Vector cursorOffset( + math::Vector cursorOffset( (selected % cols) * (ColWidth() + colGap) - cursor->Width(), ((selected - start) / cols) * RowHeight()); // This fixes the position of the third column of the inventory and capsule menus. if (thirdColumnHack && selected % cols == 2) { - cursorOffset += geometry::Vector(font->CharWidth() * thirdColumnHack, 0); + cursorOffset += math::Vector(font->CharWidth() * thirdColumnHack, 0); } switch (state) { case STATE_INACTIVE: @@ -288,9 +288,9 @@ void Menu::Draw(SDL_Surface *dest, const geometry::Vector &position) con break; case STATE_DUAL: cursor->Draw(dest, position + cursorOffset - - geometry::Vector(selectedCursor->Width(), 0)); + - math::Vector(selectedCursor->Width(), 0)); if (secondarySelection >= start && secondarySelection <= end) { - geometry::Vector secondaryOffset( + math::Vector secondaryOffset( (secondarySelection % cols) * (ColWidth() + colGap) - cursor->Width(), ((secondarySelection - start) / cols) * RowHeight()); selectedCursor->Draw(dest, position + secondaryOffset); diff --git a/src/graphics/Sprite.cpp b/src/graphics/Sprite.cpp index d74bd0d..1b85830 100644 --- a/src/graphics/Sprite.cpp +++ b/src/graphics/Sprite.cpp @@ -3,7 +3,7 @@ #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/Sprite.h b/src/graphics/Sprite.h index 6e248ff..8aa5208 100644 --- a/src/graphics/Sprite.h +++ b/src/graphics/Sprite.h @@ -1,7 +1,7 @@ #ifndef GRAPHICS_SPRITE_H_ #define GRAPHICS_SPRITE_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -20,32 +20,32 @@ public: public: int Width() const { return size.X(); } int Height() const { return size.Y(); } - const geometry::Vector &Size() const { return size; } - 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); + const math::Vector &Size() const { return size; } + void Draw(SDL_Surface *dest, const math::Vector &position, int col = 0, int row = 0) const; + void DrawTopRight(SDL_Surface *dest, const math::Vector &position, int col = 0, int row = 0) const { + math::Vector offset(-Width(), 0); Draw(dest, position + offset, col, row); } - void DrawCenter(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const { + void DrawCenter(SDL_Surface *dest, const math::Vector &position, int col = 0, int row = 0) const { Draw(dest, position - (Size() / 2), col, row); } - void DrawCenterBottom(SDL_Surface *dest, const geometry::Vector &position, int col = 0, int row = 0) const { - geometry::Vector offset(-Width() / 2, -Height()); + void DrawCenterBottom(SDL_Surface *dest, const math::Vector &position, int col = 0, int row = 0) const { + math::Vector offset(-Width() / 2, -Height()); Draw(dest, position + offset, col, row); } public: void SetSurface(SDL_Surface *s) { surface = s; } - void SetSize(const geometry::Vector &s) { size = s; } - void SetOffset(const geometry::Vector &o) { offset = o; } + void SetSize(const math::Vector &s) { size = s; } + void SetOffset(const math::Vector &o) { offset = o; } static void CreateTypeDescription(); static void Construct(void *); private: SDL_Surface *surface; - geometry::Vector size; - geometry::Vector offset; + math::Vector size; + math::Vector offset; }; diff --git a/src/graphics/Texture.cpp b/src/graphics/Texture.cpp index f53c82f..db45b3d 100644 --- a/src/graphics/Texture.cpp +++ b/src/graphics/Texture.cpp @@ -4,7 +4,7 @@ #include "../loader/TypeDescription.h" #include "../sdl/utility.h" -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; diff --git a/src/graphics/Texture.h b/src/graphics/Texture.h index bd85aaa..0de987a 100644 --- a/src/graphics/Texture.h +++ b/src/graphics/Texture.h @@ -1,7 +1,7 @@ #ifndef GRAPHICS_TEXTURE_H_ #define GRAPHICS_TEXTURE_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -12,27 +12,27 @@ class Texture { public: explicit Texture( SDL_Surface *surface = 0, - const geometry::Vector &size = geometry::Vector(), - const geometry::Vector &offset = geometry::Vector()); + const math::Vector &size = math::Vector(), + const math::Vector &offset = math::Vector()); ~Texture(); static const int TYPE_ID = 410; public: - void Render(SDL_Surface *dest, const geometry::Vector &from, const geometry::Vector &to) const; + void Render(SDL_Surface *dest, const math::Vector &from, const math::Vector &to) const; public: void SetSurface(SDL_Surface *s) { surface = s; } - void SetSize(const geometry::Vector &s) { size = s; } - void SetOffset(const geometry::Vector &o) { offset = o; } + void SetSize(const math::Vector &s) { size = s; } + void SetOffset(const math::Vector &o) { offset = o; } static void CreateTypeDescription(); static void Construct(void *); private: SDL_Surface *surface; - geometry::Vector size; - geometry::Vector offset; + math::Vector size; + math::Vector offset; }; diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index e64110d..46b4bc3 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -40,7 +40,7 @@ using graphics::Gauge; using graphics::ComplexAnimation; using graphics::SimpleAnimation; using graphics::Sprite; -using geometry::Vector; +using math::Vector; using std::make_pair; using std::set; using std::string; diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index fc1499d..5707959 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -8,7 +8,7 @@ #include "../battle/fwd.h" #include "../common/fwd.h" #include "../common/Script.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Color.h" #include "../graphics/ComplexAnimation.h" #include "../graphics/fwd.h" diff --git a/src/main.cpp b/src/main.cpp index 7bde641..a890871 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ #include "common/Script.h" #include "common/Spell.h" #include "common/Stats.h" -#include "geometry/Vector.h" +#include "math/Vector.h" #include "graphics/CharSelect.h" #include "graphics/ComplexAnimation.h" #include "graphics/Font.h" @@ -63,7 +63,7 @@ using common::GameConfig; using common::GameState; using common::Hero; using common::Spell; -using geometry::Vector; +using math::Vector; using graphics::Texture; using loader::Caster; using loader::Interpreter; diff --git a/src/map/Area.cpp b/src/map/Area.cpp index a64dab2..2c7f1b8 100644 --- a/src/map/Area.cpp +++ b/src/map/Area.cpp @@ -8,7 +8,7 @@ #include -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; @@ -24,7 +24,7 @@ Area::Area() } -Tile *Area::TileAt(const geometry::Vector &offset) { +Tile *Area::TileAt(const math::Vector &offset) { int tileIndex(offset.Y() * width + offset.X()); if (tileIndex < numTiles) { return tiles +tileIndex; @@ -33,7 +33,7 @@ Tile *Area::TileAt(const geometry::Vector &offset) { } } -const Tile *Area::TileAt(const geometry::Vector &offset) const { +const Tile *Area::TileAt(const math::Vector &offset) const { int tileIndex(offset.Y() * width + offset.X()); if (tileIndex < numTiles) { return tiles +tileIndex; diff --git a/src/map/Area.h b/src/map/Area.h index 5ea3587..90f8f5f 100644 --- a/src/map/Area.h +++ b/src/map/Area.h @@ -2,7 +2,7 @@ #define MAP_AREA_H_ #include "fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" #include @@ -27,16 +27,16 @@ public: /// Get the height in tiles. int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); } /// Get the size in tiles. - geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } + math::Vector Size() const { return math::Vector(Width(), Height()); } /// Get a tile by tile coordinates (not pixel coordinates!). - Tile *TileAt(const geometry::Vector &); - const Tile *TileAt(const geometry::Vector &) const; + Tile *TileAt(const math::Vector &); + const Tile *TileAt(const math::Vector &) const; /// Get the default battle background for this area. SDL_Surface *BattleBackground() { return battlebg; } - void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; - void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; + void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector &offset) const; + void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector &offset) const; static void CreateTypeDescription(); static void Construct(void *); diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index c2a826b..fd2cc68 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -11,7 +11,7 @@ using battle::Monster; using battle::PartyLayout; using graphics::Animation; using graphics::Sprite; -using geometry::Vector; +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; @@ -119,7 +119,7 @@ void Entity::UpdateVelocity() { } -bool Entity::TileLock(const geometry::Vector &tileSize) const { +bool Entity::TileLock(const math::Vector &tileSize) const { // TODO: change position to point to the top-left corner of a tile Vector tilePosition(position); return (tilePosition.X() % tileSize.X() == 0) && (tilePosition.Y() % tileSize.Y() == 0); diff --git a/src/map/Entity.h b/src/map/Entity.h index d1746c7..be3197d 100644 --- a/src/map/Entity.h +++ b/src/map/Entity.h @@ -3,7 +3,7 @@ #include "../battle/fwd.h" #include "../battle/Monster.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/fwd.h" #include "../graphics/Animation.h" @@ -38,20 +38,20 @@ public: public: /// Pixel resolved position of the entity's top left corner on the map. - geometry::Vector &Position() { return position; } - const geometry::Vector &Position() const { return position; } + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } /// Velocity of the entity in pixels per second. - geometry::Vector &Velocity() { return velocity; } - const geometry::Vector &Velocity() const { return velocity; } + math::Vector &Velocity() { return velocity; } + const math::Vector &Velocity() const { return velocity; } /// Offset of the entity's sprite's to left corner relative to Position(). - geometry::Vector &SpriteOffset() { return spriteOffset; } - const geometry::Vector &SpriteOffset() const { return spriteOffset; } + math::Vector &SpriteOffset() { return spriteOffset; } + const math::Vector &SpriteOffset() const { return spriteOffset; } /// Reset the entity to the stored tile coordinates (usually set when /// loading game data). - void ResetPosition(const geometry::Vector &tileSize) { position = tilePosition * tileSize; } + void ResetPosition(const math::Vector &tileSize) { position = tilePosition * tileSize; } /// Set the animation to use for animated entities. /// For orientable entities, the animation should have north, south, east, @@ -124,12 +124,12 @@ public: void RemoveFollower(Entity *); /// Check if position locks into grid defined by given tileSize. - bool TileLock(const geometry::Vector &tileSize) const; + bool TileLock(const math::Vector &tileSize) const; /// Integrate this entity's physical properties over given time interval. void Update(float deltaT); - void Render(SDL_Surface *, const geometry::Vector &offset) const; + void Render(SDL_Surface *, const math::Vector &offset) const; static void CreateTypeDescription(); static void Construct(void *); @@ -146,10 +146,10 @@ private: battle::Monster **monsters; int numMonsters; graphics::AnimationRunner runner; - geometry::Vector spriteOffset; - geometry::Vector tilePosition; - geometry::Vector position; - geometry::Vector velocity; + math::Vector spriteOffset; + math::Vector tilePosition; + math::Vector position; + math::Vector velocity; Orientation orientation; float speed; int flags; diff --git a/src/map/Map.cpp b/src/map/Map.cpp index aeec93c..823847c 100644 --- a/src/map/Map.cpp +++ b/src/map/Map.cpp @@ -10,7 +10,7 @@ #include -using geometry::Vector; +using math::Vector; using graphics::Sprite; using loader::FieldDescription; using loader::Interpreter; @@ -76,7 +76,7 @@ const Tile *Map::TileAt(const Vector &offset) const { } } -Trigger *Map::TriggerAt(const geometry::Vector &offset) { +Trigger *Map::TriggerAt(const math::Vector &offset) { // TODO: add support for multiple triggers on a tile? Vector coords(TileCoordinates(offset)); for (Trigger *i(triggers); i != triggers + numTriggers; ++i) { @@ -87,7 +87,7 @@ Trigger *Map::TriggerAt(const geometry::Vector &offset) { return 0; } -SDL_Surface *Map::BattleBackgroundAt(const geometry::Vector &position) { +SDL_Surface *Map::BattleBackgroundAt(const math::Vector &position) { Tile *tile(TileAt(position)); if (tile && tile->BattleBackground()) { return tile->BattleBackground(); diff --git a/src/map/Map.h b/src/map/Map.h index 06caadf..595e62b 100644 --- a/src/map/Map.h +++ b/src/map/Map.h @@ -3,7 +3,7 @@ #include "Entity.h" #include "fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/fwd.h" #include @@ -32,29 +32,29 @@ public: /// The sprite used as the tileset. const graphics::Sprite *Tileset() const { return tileset; } /// Returns the Area at given pixel coordinates or 0 if off the map. - Area *AreaAt(const geometry::Vector &); - const Area *AreaAt(const geometry::Vector &) const; + Area *AreaAt(const math::Vector &); + const Area *AreaAt(const math::Vector &) const; /// Returns the Tile at given pixel coordinates or 0 if off the map. - Tile *TileAt(const geometry::Vector &); - const Tile *TileAt(const geometry::Vector &) const; + Tile *TileAt(const math::Vector &); + const Tile *TileAt(const math::Vector &) const; /// Returns the Trigger at given pixel coordinates or 0 if off the map. /// Multiple triggers are not supported. The first one found is returned. - Trigger *TriggerAt(const geometry::Vector &); + Trigger *TriggerAt(const math::Vector &); /// The battle background image for this map if neither the tile nor the /// area has one specified. - SDL_Surface *BattleBackgroundAt(const geometry::Vector &); + SDL_Surface *BattleBackgroundAt(const math::Vector &); /// Convert coordinates pixel to tile. - geometry::Vector TileCoordinates(const geometry::Vector &) const; + math::Vector TileCoordinates(const math::Vector &) const; Entity *EntitiesBegin() { return entities; } Entity *EntitiesEnd() { return entities + numEntities; } /// Render the map. /// Entities are not rendered by this function. - void Render(SDL_Surface *dest, const geometry::Vector &offset) const; + void Render(SDL_Surface *dest, const math::Vector &offset) const; /// Render a debugging overlay that includes collision and trigger /// information. - void RenderDebug(SDL_Surface *dest, const geometry::Vector &offset) const; + void RenderDebug(SDL_Surface *dest, const math::Vector &offset) const; static void CreateTypeDescription(); static void Construct(void *); diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index b223f4f..121dfbc 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -18,7 +18,7 @@ using app::Application; using app::Input; using battle::BattleState; using common::GameConfig; -using geometry::Vector; +using math::Vector; using graphics::ColorFade; using menu::PartyMenu; diff --git a/src/map/MapState.h b/src/map/MapState.h index af66d24..5bbd6f8 100644 --- a/src/map/MapState.h +++ b/src/map/MapState.h @@ -7,7 +7,7 @@ #include "../common/fwd.h" #include "../common/ScriptHost.h" #include "../common/ScriptRunner.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Camera.h" #include @@ -34,7 +34,7 @@ public: void SetWalkingSpeed(float s) { walkingSpeed = s; } - void Transition(Map *, const geometry::Vector &coordinates); + void Transition(Map *, const math::Vector &coordinates); virtual void HandleSyscall(common::ScriptRunner &); @@ -53,7 +53,7 @@ private: void LoadMap(Map *); bool CheckBlocking(); - bool CheckBlocking(const geometry::Vector &position, Entity::Orientation direction) const; + bool CheckBlocking(const math::Vector &position, Entity::Orientation direction) const; void OnTileLock(); bool OnGridLock(); @@ -81,7 +81,7 @@ private: Entity *pushed; common::ScriptRunner runner; app::Timer moveTimer; - geometry::Vector lastLock; + math::Vector lastLock; graphics::Camera camera; std::vector entities; float walkingSpeed; diff --git a/src/map/Tile.h b/src/map/Tile.h index 84c740a..252ede3 100644 --- a/src/map/Tile.h +++ b/src/map/Tile.h @@ -1,7 +1,7 @@ #ifndef MAP_TILE_H_ #define MAP_TILE_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -26,7 +26,7 @@ public: SDL_Surface *BattleBackground() { return battlebg; } - const geometry::Vector &Offset() const { return offset; } + const math::Vector &Offset() const { return offset; } bool BlocksNorth() const { return flags & BLOCK_NORTH; } bool BlocksEast() const { return flags & BLOCK_EAST; } @@ -38,12 +38,12 @@ public: // temporary setters public: - Tile &SetOffset(const geometry::Vector &o) { offset = o; return *this; } + Tile &SetOffset(const math::Vector &o) { offset = o; return *this; } Tile &SetFlags(Uint32 f) { flags = f; return *this; } private: SDL_Surface *battlebg; - geometry::Vector offset; + math::Vector offset; int flags; }; diff --git a/src/map/TransitionState.cpp b/src/map/TransitionState.cpp index dd1dbc5..7ea3588 100644 --- a/src/map/TransitionState.cpp +++ b/src/map/TransitionState.cpp @@ -6,7 +6,7 @@ using app::Application; using app::State; using app::Input; -using geometry::Vector; +using math::Vector; namespace map { diff --git a/src/map/TransitionState.h b/src/map/TransitionState.h index 761be8b..9f2cd19 100644 --- a/src/map/TransitionState.h +++ b/src/map/TransitionState.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "../app/State.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" namespace map { @@ -11,7 +11,7 @@ class TransitionState : public app::State { public: - TransitionState(MapState *, Map *, const geometry::Vector &); + TransitionState(MapState *, Map *, const math::Vector &); virtual ~TransitionState() { } public: @@ -30,7 +30,7 @@ private: private: MapState *ms; Map *map; - const geometry::Vector &coordinates; + const math::Vector &coordinates; }; diff --git a/src/map/Trigger.h b/src/map/Trigger.h index 7824858..024b1f2 100644 --- a/src/map/Trigger.h +++ b/src/map/Trigger.h @@ -4,7 +4,7 @@ #include "Entity.h" #include "fwd.h" #include "../common/Script.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" namespace map { @@ -26,7 +26,7 @@ public: }; public: - const geometry::Vector &TilePosition() const { return tilePosition; } + const math::Vector &TilePosition() const { return tilePosition; } Type GetType() const { return Type(type); } bool HasScript() const { return script; } common::Script &GetScript() { return *script; } @@ -37,13 +37,13 @@ public: // temporary setters public: - void SetTilePosition(const geometry::Vector &p) { tilePosition = p; } + void SetTilePosition(const math::Vector &p) { tilePosition = p; } void SetType(Type t) { type = t; } void SetScript(common::Script *s) { script = s; } private: common::Script *script; - geometry::Vector tilePosition; + math::Vector tilePosition; int type; }; diff --git a/src/geometry/Vector.h b/src/math/Vector.h similarity index 98% rename from src/geometry/Vector.h rename to src/math/Vector.h index 8822b1b..fb07d33 100644 --- a/src/geometry/Vector.h +++ b/src/math/Vector.h @@ -1,11 +1,11 @@ -#ifndef GEOMETRY_VECTOR_H_ -#define GEOMETRY_VECTOR_H_ +#ifndef MATH_VECTOR_H_ +#define MATH_VECTOR_H_ #include #include #include -namespace geometry { +namespace math { /// Basic vector class with emphasis on graphical/computational ease of use /// rather than mathematical accuracy ;) . diff --git a/src/math/fwd.h b/src/math/fwd.h new file mode 100644 index 0000000..9e143fd --- /dev/null +++ b/src/math/fwd.h @@ -0,0 +1,11 @@ +#ifndef MATH_FWD_H_ +#define MATH_FWD_H_ + +namespace math { + +template +class Vector; + +} + +#endif /* MATH_FWD_H_ */ diff --git a/src/menu/CapsuleChangeMenu.cpp b/src/menu/CapsuleChangeMenu.cpp index 386d22c..de94929 100644 --- a/src/menu/CapsuleChangeMenu.cpp +++ b/src/menu/CapsuleChangeMenu.cpp @@ -16,7 +16,7 @@ using app::Input; using common::Capsule; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; diff --git a/src/menu/CapsuleChangeMenu.h b/src/menu/CapsuleChangeMenu.h index a48a6b2..354cb61 100644 --- a/src/menu/CapsuleChangeMenu.h +++ b/src/menu/CapsuleChangeMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" namespace menu { @@ -21,7 +21,7 @@ public: virtual void UpdateWorld(float deltaT); virtual void Render(SDL_Surface *); - void RenderClasses(SDL_Surface *, const geometry::Vector &) const; + void RenderClasses(SDL_Surface *, const math::Vector &) const; public: int Width() const; diff --git a/src/menu/CapsuleFeedMenu.cpp b/src/menu/CapsuleFeedMenu.cpp index e078928..43324c7 100644 --- a/src/menu/CapsuleFeedMenu.cpp +++ b/src/menu/CapsuleFeedMenu.cpp @@ -15,7 +15,7 @@ using app::Input; using common::Capsule; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; diff --git a/src/menu/CapsuleFeedMenu.h b/src/menu/CapsuleFeedMenu.h index 1999674..3ea8c1a 100644 --- a/src/menu/CapsuleFeedMenu.h +++ b/src/menu/CapsuleFeedMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -40,12 +40,12 @@ private: void LoadInventory(); void FeedSelected(); - void RenderName(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderSprite(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderGrowth(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderHunger(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderItems(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderName(SDL_Surface *screen, const math::Vector &offset) const; + void RenderSprite(SDL_Surface *screen, const math::Vector &offset) const; + void RenderGrowth(SDL_Surface *screen, const math::Vector &offset) const; + void RenderHunger(SDL_Surface *screen, const math::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderItems(SDL_Surface *screen, const math::Vector &offset) const; private: CapsuleMenu *parent; diff --git a/src/menu/CapsuleMenu.cpp b/src/menu/CapsuleMenu.cpp index 564b3bf..67afd57 100644 --- a/src/menu/CapsuleMenu.cpp +++ b/src/menu/CapsuleMenu.cpp @@ -18,7 +18,7 @@ using app::Input; using common::Capsule; using common::Stats; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; @@ -220,7 +220,7 @@ void CapsuleMenu::RenderStats(SDL_Surface *screen, const Vector &offset) co font.DrawNumberRight(capsule.NextLevel(), screen, lineHead); } -void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector &offset, const char *name, int value) const { +void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const math::Vector &offset, const char *name, int value) const { const Font &font(*Res().statusFont); const Vector numberOffset(4 * font.CharWidth(), 0); diff --git a/src/menu/CapsuleMenu.h b/src/menu/CapsuleMenu.h index 6358a6a..8f80637 100644 --- a/src/menu/CapsuleMenu.h +++ b/src/menu/CapsuleMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -21,12 +21,12 @@ public: virtual void Render(SDL_Surface *); void RenderBackground(SDL_Surface *screen) const; - void RenderCapsule(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderInfo(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderWheel(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStats(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStatsLine(SDL_Surface *screen, const geometry::Vector &offset, const char *name, int value) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderCapsule(SDL_Surface *screen, const math::Vector &offset) const; + void RenderInfo(SDL_Surface *screen, const math::Vector &offset) const; + void RenderWheel(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStats(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStatsLine(SDL_Surface *screen, const math::Vector &offset, const char *name, int value) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; public: common::GameConfig &Game(); diff --git a/src/menu/CapsuleNameMenu.cpp b/src/menu/CapsuleNameMenu.cpp index 58db75e..2bdad28 100644 --- a/src/menu/CapsuleNameMenu.cpp +++ b/src/menu/CapsuleNameMenu.cpp @@ -17,7 +17,7 @@ using app::Input; using common::Capsule; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; diff --git a/src/menu/CapsuleNameMenu.h b/src/menu/CapsuleNameMenu.h index 77211e2..f85d11c 100644 --- a/src/menu/CapsuleNameMenu.h +++ b/src/menu/CapsuleNameMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/CharSelect.h" namespace menu { @@ -41,8 +41,8 @@ private: void RemoveChar(); void StoreName(); - void RenderName(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderAlphabet(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderName(SDL_Surface *screen, const math::Vector &offset) const; + void RenderAlphabet(SDL_Surface *screen, const math::Vector &offset) const; private: CapsuleMenu *parent; diff --git a/src/menu/ChangeHero.cpp b/src/menu/ChangeHero.cpp index 7cd9b08..0c1ed4a 100644 --- a/src/menu/ChangeHero.cpp +++ b/src/menu/ChangeHero.cpp @@ -12,7 +12,7 @@ #include using app::Input; -using geometry::Vector; +using math::Vector; using std::swap; namespace menu { diff --git a/src/menu/ChangeHero.h b/src/menu/ChangeHero.h index 4b80694..ca5f64b 100644 --- a/src/menu/ChangeHero.h +++ b/src/menu/ChangeHero.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "../app/State.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -34,7 +34,7 @@ private: void SelectedHero(int index); - void RenderHighlight(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderHighlight(SDL_Surface *screen, const math::Vector &offset) const; static void OnHeroSelected(void *, int); diff --git a/src/menu/ConfigMenu.cpp b/src/menu/ConfigMenu.cpp index 6d6e2d1..e96c76b 100644 --- a/src/menu/ConfigMenu.cpp +++ b/src/menu/ConfigMenu.cpp @@ -11,7 +11,7 @@ using app::Input; using common::GameState; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; @@ -115,7 +115,7 @@ void ConfigMenu::Render(SDL_Surface *screen) { RenderMenu(screen, offset + menuOffset); } -void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector &offset) const { +void ConfigMenu::RenderHeadline(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().normalFont); const Frame &frame(*parent->Res().statusFrame); const Vector textOffset( @@ -125,7 +125,7 @@ void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector font.DrawString(parent->Res().mainMenuConfigText, screen, offset + textOffset, 6); } -void ConfigMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const { +void ConfigMenu::RenderMenu(SDL_Surface *screen, const math::Vector &offset) const { const Resources &res(parent->Res()); const Font &font(*res.normalFont); const Font &inactiveFont(*res.inactiveFont); diff --git a/src/menu/ConfigMenu.h b/src/menu/ConfigMenu.h index f7dda53..f5e31c1 100644 --- a/src/menu/ConfigMenu.h +++ b/src/menu/ConfigMenu.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "../app/State.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -31,8 +31,8 @@ private: virtual void OnResize(int width, int height); - void RenderHeadline(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderHeadline(SDL_Surface *screen, const math::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/menu/EquipMenu.cpp b/src/menu/EquipMenu.cpp index 86e8cdb..494c25a 100644 --- a/src/menu/EquipMenu.cpp +++ b/src/menu/EquipMenu.cpp @@ -19,7 +19,7 @@ using common::Hero; using common::Inventory; using common::Item; using common::Stats; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; diff --git a/src/menu/EquipMenu.h b/src/menu/EquipMenu.h index 5c2cc9b..ffa7a83 100644 --- a/src/menu/EquipMenu.h +++ b/src/menu/EquipMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -47,12 +47,12 @@ private: void LoadInventory(); void EquipSelected(); - void RenderStatus(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStats(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const geometry::Vector &position) const; - void RenderEquipmentMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderActionMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderInventoryMenu(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderStatus(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStats(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const math::Vector &position) const; + void RenderEquipmentMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderActionMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderInventoryMenu(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/menu/HeroStatus.cpp b/src/menu/HeroStatus.cpp index 30091cb..919fd85 100644 --- a/src/menu/HeroStatus.cpp +++ b/src/menu/HeroStatus.cpp @@ -5,7 +5,7 @@ #include "../graphics/Font.h" #include "../graphics/Sprite.h" -using geometry::Vector; +using math::Vector; namespace menu { diff --git a/src/menu/HeroStatus.h b/src/menu/HeroStatus.h index 03c7811..e24cb6c 100644 --- a/src/menu/HeroStatus.h +++ b/src/menu/HeroStatus.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -21,9 +21,9 @@ public: int Width() const; int Height() const; - geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } + math::Vector Size() const { return math::Vector(Width(), Height()); } - void Render(SDL_Surface *screen, const geometry::Vector &offset) const; + void Render(SDL_Surface *screen, const math::Vector &offset) const; private: const Resources *res; diff --git a/src/menu/InventoryMenu.cpp b/src/menu/InventoryMenu.cpp index c980f97..95ca746 100644 --- a/src/menu/InventoryMenu.cpp +++ b/src/menu/InventoryMenu.cpp @@ -14,7 +14,7 @@ using app::Input; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; using std::swap; diff --git a/src/menu/InventoryMenu.h b/src/menu/InventoryMenu.h index e0cb6fe..11acf46 100644 --- a/src/menu/InventoryMenu.h +++ b/src/menu/InventoryMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -33,8 +33,8 @@ private: void LoadInventory(); - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderInventory(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderInventory(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/menu/PartyMenu.cpp b/src/menu/PartyMenu.cpp index f3176b3..577772e 100644 --- a/src/menu/PartyMenu.cpp +++ b/src/menu/PartyMenu.cpp @@ -14,14 +14,14 @@ #include "../app/Input.h" #include "../common/GameConfig.h" #include "../common/GameState.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Texture.h" using app::Input; using common::GameConfig; -using geometry::Vector; +using math::Vector; namespace menu { diff --git a/src/menu/PartyMenu.h b/src/menu/PartyMenu.h index 08ffa38..a009c33 100644 --- a/src/menu/PartyMenu.h +++ b/src/menu/PartyMenu.h @@ -5,7 +5,7 @@ #include "HeroStatus.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -33,11 +33,11 @@ public: public: void RenderBackground(SDL_Surface *screen) const; - void RenderHeros(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderInfo(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderHeros(SDL_Surface *screen, const math::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderInfo(SDL_Surface *screen, const math::Vector &offset) const; - geometry::Vector StatusOffset(int index) const; + math::Vector StatusOffset(int index) const; const HeroStatus &GetHeroStatus(int index) const { return status[index]; } static void OnEquipSelect(void *, int); @@ -66,7 +66,7 @@ private: private: HeroStatus status[4]; - geometry::Vector statusPositions[4]; + math::Vector statusPositions[4]; common::GameConfig *game; graphics::Menu mainMenu; diff --git a/src/menu/ScenarioMenu.cpp b/src/menu/ScenarioMenu.cpp index 2c317bb..a86f9a9 100644 --- a/src/menu/ScenarioMenu.cpp +++ b/src/menu/ScenarioMenu.cpp @@ -14,7 +14,7 @@ using app::Input; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; @@ -100,7 +100,7 @@ int ScenarioMenu::Height() const { return parent->Height(); } -void ScenarioMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector &offset) const { +void ScenarioMenu::RenderHeadline(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().normalFont); const Frame &frame(*parent->Res().statusFrame); const Vector textOffset(2 * font.CharWidth(), font.CharHeight()); @@ -110,7 +110,7 @@ void ScenarioMenu::RenderHeadline(SDL_Surface *screen, const geometry::VectorRes().scenarioMenuHeadline, screen, offset + textOffset); } -void ScenarioMenu::RenderItems(SDL_Surface *screen, const geometry::Vector &offset) const { +void ScenarioMenu::RenderItems(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().normalFont); const Frame &frame(*parent->Res().statusFrame); const Vector menuOffset(3 * font.CharWidth(), font.CharHeight() + font.CharHeight() / 4); diff --git a/src/menu/ScenarioMenu.h b/src/menu/ScenarioMenu.h index 23cb514..3e99ef0 100644 --- a/src/menu/ScenarioMenu.h +++ b/src/menu/ScenarioMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -33,8 +33,8 @@ private: void LoadItems(); - void RenderHeadline(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderItems(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderHeadline(SDL_Surface *screen, const math::Vector &offset) const; + void RenderItems(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/menu/SelectHero.cpp b/src/menu/SelectHero.cpp index a46333a..e573d32 100644 --- a/src/menu/SelectHero.cpp +++ b/src/menu/SelectHero.cpp @@ -8,11 +8,11 @@ #include "../common/GameConfig.h" #include "../common/GameState.h" #include "../common/Hero.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" using app::Input; -using geometry::Vector; +using math::Vector; namespace menu { diff --git a/src/menu/SpellMenu.cpp b/src/menu/SpellMenu.cpp index bb66d3c..af743cc 100644 --- a/src/menu/SpellMenu.cpp +++ b/src/menu/SpellMenu.cpp @@ -19,7 +19,7 @@ using app::Input; using common::Hero; using common::Spell; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; using std::vector; diff --git a/src/menu/SpellMenu.h b/src/menu/SpellMenu.h index 6cef923..42dbfbb 100644 --- a/src/menu/SpellMenu.h +++ b/src/menu/SpellMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -37,9 +37,9 @@ private: void LoadSpells(); - void RenderHighlight(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderSpells(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderHighlight(SDL_Surface *screen, const math::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; + void RenderSpells(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/menu/StatusMenu.cpp b/src/menu/StatusMenu.cpp index 55ba56e..09c9405 100644 --- a/src/menu/StatusMenu.cpp +++ b/src/menu/StatusMenu.cpp @@ -17,7 +17,7 @@ using app::Input; using common::Hero; using common::Item; using common::Stats; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; @@ -190,7 +190,7 @@ void StatusMenu::RenderEquipmentLine(const Item *item, SDL_Surface *screen, cons } } -void StatusMenu::RenderExperience(SDL_Surface *screen, const geometry::Vector &offset) const { +void StatusMenu::RenderExperience(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().statusFont); font.DrawStringRight(parent->Res().experienceLabel, screen, offset, 10); @@ -198,7 +198,7 @@ void StatusMenu::RenderExperience(SDL_Surface *screen, const geometry::Vector &offset) const { +void StatusMenu::RenderNextLevel(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().statusFont); font.DrawStringRight(parent->Res().nextLevelLabel, screen, offset, 10); @@ -206,7 +206,7 @@ void StatusMenu::RenderNextLevel(SDL_Surface *screen, const geometry::Vector &offset) const { +void StatusMenu::RenderIkari(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().statusFont); font.DrawString(parent->Res().ipLabel, screen, offset, 5); @@ -217,7 +217,7 @@ void StatusMenu::RenderIkari(SDL_Surface *screen, const geometry::Vector &o font.DrawChar('%', screen, percentOffset); } -void StatusMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const { +void StatusMenu::RenderMenu(SDL_Surface *screen, const math::Vector &offset) const { const Font &font(*parent->Res().normalFont); const Frame &frame(*parent->Res().statusFrame); diff --git a/src/menu/StatusMenu.h b/src/menu/StatusMenu.h index 08d2e0b..eaf1017 100644 --- a/src/menu/StatusMenu.h +++ b/src/menu/StatusMenu.h @@ -4,7 +4,7 @@ #include "fwd.h" #include "../app/State.h" #include "../common/fwd.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Menu.h" namespace menu { @@ -37,17 +37,17 @@ private: const common::Hero &GetHero() const; - void RenderStatus(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStats(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const geometry::Vector &position) const; - void RenderEquipment(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderEquipmentLine(const common::Item *, SDL_Surface *screen, const geometry::Vector &position) const; + void RenderStatus(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStats(SDL_Surface *screen, const math::Vector &offset) const; + void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const math::Vector &position) const; + void RenderEquipment(SDL_Surface *screen, const math::Vector &offset) const; + void RenderEquipmentLine(const common::Item *, SDL_Surface *screen, const math::Vector &position) const; /// @param offset the top right corner! - void RenderExperience(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderExperience(SDL_Surface *screen, const math::Vector &offset) const; /// @param offset the top right corner! - void RenderNextLevel(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderIkari(SDL_Surface *screen, const geometry::Vector &offset) const; - void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderNextLevel(SDL_Surface *screen, const math::Vector &offset) const; + void RenderIkari(SDL_Surface *screen, const math::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const math::Vector &offset) const; private: PartyMenu *parent; diff --git a/src/sdl/utility.cpp b/src/sdl/utility.cpp index 94eb625..1dbf502 100644 --- a/src/sdl/utility.cpp +++ b/src/sdl/utility.cpp @@ -2,7 +2,7 @@ #include -using geometry::Vector; +using math::Vector; namespace sdl { @@ -15,7 +15,7 @@ void HorizontalLine(SDL_Surface *dst, const Vector &position, unsigned int SDL_FillRect(dst, &destRect, color); } -void VerticalLine(SDL_Surface *dst, const geometry::Vector &position, unsigned int length, Uint32 color) { +void VerticalLine(SDL_Surface *dst, const math::Vector &position, unsigned int length, Uint32 color) { SDL_Rect destRect; destRect.x = position.X(); destRect.y = position.Y(); diff --git a/src/sdl/utility.h b/src/sdl/utility.h index 40867dd..295877f 100644 --- a/src/sdl/utility.h +++ b/src/sdl/utility.h @@ -1,15 +1,15 @@ #ifndef SDL_UTILITY_H_ #define SDL_UTILITY_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include namespace sdl { -void HorizontalLine(SDL_Surface *dst, const geometry::Vector &position, unsigned int length, Uint32 color); -void VerticalLine(SDL_Surface *dst, const geometry::Vector &position, unsigned int length, Uint32 color); +void HorizontalLine(SDL_Surface *dst, const math::Vector &position, unsigned int length, Uint32 color); +void VerticalLine(SDL_Surface *dst, const math::Vector &position, unsigned int length, Uint32 color); -void OutlineRect(SDL_Surface *dst, const geometry::Vector &from, const geometry::Vector &to, Uint32 color); +void OutlineRect(SDL_Surface *dst, const math::Vector &from, const math::Vector &to, Uint32 color); void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); } diff --git a/tests/geometry/VectorTest.cpp b/tests/math/VectorTest.cpp similarity index 96% rename from tests/geometry/VectorTest.cpp rename to tests/math/VectorTest.cpp index 7ba58d2..2f10504 100644 --- a/tests/geometry/VectorTest.cpp +++ b/tests/math/VectorTest.cpp @@ -2,12 +2,12 @@ #include -CPPUNIT_TEST_SUITE_REGISTRATION(test_geometry::VectorTest); +CPPUNIT_TEST_SUITE_REGISTRATION(test_math::VectorTest); -using geometry::Vector; +using math::Vector; -namespace test_geometry { +namespace test_math { void VectorTest::setUp() { diff --git a/tests/geometry/VectorTest.h b/tests/math/VectorTest.h similarity index 76% rename from tests/geometry/VectorTest.h rename to tests/math/VectorTest.h index e6e2b29..fdd2c3a 100644 --- a/tests/geometry/VectorTest.h +++ b/tests/math/VectorTest.h @@ -1,12 +1,12 @@ -#ifndef TEST_GEOMETRY_VECTORTEST_H_ -#define TEST_GEOMETRY_VECTORTEST_H_ +#ifndef TEST_MATH_VECTORTEST_H_ +#define TEST_MATH_VECTORTEST_H_ -#include "../../src/geometry/Vector.h" +#include "../../src/math/Vector.h" #include -namespace test_geometry { +namespace test_math { class VectorTest : public CppUnit::TestFixture { -- 2.39.2