]> git.localhorst.tv Git - l2e.git/commitdiff
renamed namespace geometry -> math
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 27 Dec 2012 06:51:50 +0000 (07:51 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 27 Dec 2012 07:21:54 +0000 (08:21 +0100)
110 files changed:
l2e.cbp
src/battle/AttackTypeMenu.cpp
src/battle/AttackTypeMenu.h
src/battle/BattleState.cpp
src/battle/BattleState.h
src/battle/Capsule.h
src/battle/Hero.h
src/battle/HeroTag.cpp
src/battle/HeroTag.h
src/battle/Monster.h
src/battle/MoveMenu.cpp
src/battle/MoveMenu.h
src/battle/NumberAnimation.cpp
src/battle/NumberAnimation.h
src/battle/PartyLayout.cpp
src/battle/PartyLayout.h
src/battle/SmallHeroTag.cpp
src/battle/SmallHeroTag.h
src/battle/states/PerformAttacks.cpp
src/battle/states/PerformAttacks.h
src/battle/states/RunState.cpp
src/battle/states/RunState.h
src/battle/states/SelectAttackType.cpp
src/battle/states/SelectAttackType.h
src/battle/states/SelectIkari.cpp
src/battle/states/SelectIkari.h
src/battle/states/SelectItem.cpp
src/battle/states/SelectItem.h
src/battle/states/SelectMoveAction.cpp
src/battle/states/SelectMoveAction.h
src/battle/states/SelectSpell.cpp
src/battle/states/SelectSpell.h
src/battle/states/SelectTarget.cpp
src/battle/states/SelectTarget.h
src/battle/states/SwapHeroes.cpp
src/battle/states/SwapHeroes.h
src/common/Capsule.h
src/common/ScriptRunner.cpp
src/common/ScriptRunner.h
src/geometry/Vector.h [deleted file]
src/geometry/fwd.h [deleted file]
src/graphics/Animation.cpp
src/graphics/Animation.h
src/graphics/Camera.cpp
src/graphics/Camera.h
src/graphics/CharSelect.cpp
src/graphics/CharSelect.h
src/graphics/ComplexAnimation.cpp
src/graphics/ComplexAnimation.h
src/graphics/Font.cpp
src/graphics/Font.h
src/graphics/Frame.cpp
src/graphics/Frame.h
src/graphics/Gauge.cpp
src/graphics/Gauge.h
src/graphics/Menu.h
src/graphics/Sprite.cpp
src/graphics/Sprite.h
src/graphics/Texture.cpp
src/graphics/Texture.h
src/loader/Interpreter.cpp
src/loader/Interpreter.h
src/main.cpp
src/map/Area.cpp
src/map/Area.h
src/map/Entity.cpp
src/map/Entity.h
src/map/Map.cpp
src/map/Map.h
src/map/MapState.cpp
src/map/MapState.h
src/map/Tile.h
src/map/TransitionState.cpp
src/map/TransitionState.h
src/map/Trigger.h
src/math/Vector.h [new file with mode: 0644]
src/math/fwd.h [new file with mode: 0644]
src/menu/CapsuleChangeMenu.cpp
src/menu/CapsuleChangeMenu.h
src/menu/CapsuleFeedMenu.cpp
src/menu/CapsuleFeedMenu.h
src/menu/CapsuleMenu.cpp
src/menu/CapsuleMenu.h
src/menu/CapsuleNameMenu.cpp
src/menu/CapsuleNameMenu.h
src/menu/ChangeHero.cpp
src/menu/ChangeHero.h
src/menu/ConfigMenu.cpp
src/menu/ConfigMenu.h
src/menu/EquipMenu.cpp
src/menu/EquipMenu.h
src/menu/HeroStatus.cpp
src/menu/HeroStatus.h
src/menu/InventoryMenu.cpp
src/menu/InventoryMenu.h
src/menu/PartyMenu.cpp
src/menu/PartyMenu.h
src/menu/ScenarioMenu.cpp
src/menu/ScenarioMenu.h
src/menu/SelectHero.cpp
src/menu/SpellMenu.cpp
src/menu/SpellMenu.h
src/menu/StatusMenu.cpp
src/menu/StatusMenu.h
src/sdl/utility.cpp
src/sdl/utility.h
tests/geometry/VectorTest.cpp [deleted file]
tests/geometry/VectorTest.h [deleted file]
tests/math/VectorTest.cpp [new file with mode: 0644]
tests/math/VectorTest.h [new file with mode: 0644]

diff --git a/l2e.cbp b/l2e.cbp
index 4ff83920c3f34c8cd81e6384caf2a8a117d825b3..7329d8a6728c7d3a56da8d23a995deebc443c343 100644 (file)
--- a/l2e.cbp
+++ b/l2e.cbp
                <Unit filename="src\common\TargetingMode.cpp" />
                <Unit filename="src\common\TargetingMode.h" />
                <Unit filename="src\common\fwd.h" />
-               <Unit filename="src\geometry\Vector.h" />
-               <Unit filename="src\geometry\fwd.h" />
                <Unit filename="src\graphics\Animation.cpp" />
                <Unit filename="src\graphics\Animation.h" />
                <Unit filename="src\graphics\Camera.cpp" />
                <Unit filename="src\map\Trigger.cpp" />
                <Unit filename="src\map\Trigger.h" />
                <Unit filename="src\map\fwd.h" />
+               <Unit filename="src\math\Vector.h" />
+               <Unit filename="src\math\fwd.h" />
                <Unit filename="src\menu\CapsuleChangeMenu.cpp" />
                <Unit filename="src\menu\CapsuleChangeMenu.h" />
                <Unit filename="src\menu\CapsuleFeedMenu.cpp" />
index 16bda253dd86df85206e00ba3531e8f68b354bba..952bf8122e8d06900257f34791d50c49a4c02894 100644 (file)
@@ -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<int> &position) {
+void AttackTypeMenu::Render(SDL_Surface *screen, const math::Vector<int> &position) {
        const Vector<int> &swordOffset(IconSize());
        const Vector<int> magicOffset(IconWidth(), 0);
        const Vector<int> defendOffset(2 * IconWidth(), IconHeight());
index aa5f9c5486029db579de168f04a978feb91a655e..6d32daf019c7c2bbface0a08475ac451174739b2 100644 (file)
@@ -2,7 +2,7 @@
 #define BATTLE_ATTACKTYPEMENU_H_
 
 #include "AttackChoice.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include "../graphics/Sprite.h"
 
 #include <SDL.h>
@@ -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<int> &position);
+       void Render(SDL_Surface *screen, const math::Vector<int> &position);
 
        int Width() const { return 3 * IconWidth(); }
        int Height() const { return 3 * IconHeight(); }
-       geometry::Vector<int> Size() const { return 3 * IconSize(); }
+       math::Vector<int> Size() const { return 3 * IconSize(); }
        int IconWidth() const { return icons->Width(); }
        int IconHeight() const { return icons->Height(); }
-       const geometry::Vector<int> &IconSize() const { return icons->Size(); }
+       const math::Vector<int> &IconSize() const { return icons->Size(); }
 
 private:
        const graphics::Sprite *icons;
index 085a85371530678e0d578fa1fb8560aeb3299382..8218c10504b644016ecbc8eb0c7c3a69f579595d 100644 (file)
@@ -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;
index 1c994e4f88a664c2d572173fd79c156d1daf0687..525889591d5847e8088e0c5753d28f67e6d7cfc6 100644 (file)
@@ -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<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
+       const math::Vector<int> &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<int> CalculateScreenOffset(SDL_Surface *screen) const {
-               return geometry::Vector<int>(
+       math::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
+               return math::Vector<int>(
                                (screen->w - background->w) / 2,
                                (screen->h - background->h) / 2);
        }
        int Width() const { return background->w; }
        int Height() const { return background->h; }
-       geometry::Vector<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
+       math::Vector<int> Size() const { return math::Vector<int>(Width(), Height()); }
 
-       void RenderBackground(SDL_Surface *screen, const geometry::Vector<int> &offset);
-       void RenderMonsters(SDL_Surface *screen, const geometry::Vector<int> &offset);
-       void RenderHeroes(SDL_Surface *screen, const geometry::Vector<int> &offset);
-       void RenderCapsule(SDL_Surface *screen, const geometry::Vector<int> &offset);
-       void RenderHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
-       void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
+       void RenderBackground(SDL_Surface *screen, const math::Vector<int> &offset);
+       void RenderMonsters(SDL_Surface *screen, const math::Vector<int> &offset);
+       void RenderHeroes(SDL_Surface *screen, const math::Vector<int> &offset);
+       void RenderCapsule(SDL_Surface *screen, const math::Vector<int> &offset);
+       void RenderHeroTags(SDL_Surface *screen, const math::Vector<int> &offset);
+       void RenderSmallHeroTags(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        virtual void OnEnterState(SDL_Surface *screen);
@@ -168,8 +168,8 @@ private:
        graphics::Menu<const common::Item *> itemMenu;
        HeroTag heroTags[4];
        SmallHeroTag smallHeroTags[4];
-       geometry::Vector<int> heroTagPositions[4];
-       geometry::Vector<int> smallHeroTagPositions[4];
+       math::Vector<int> heroTagPositions[4];
+       math::Vector<int> smallHeroTagPositions[4];
        Capsule capsule;
        int numHeroes;
        int activeHero;
index 7438492bc7f86a7046b999fc42ee4fb8e8755b18..8f268e18f4e74dc863b07e6b8550ce4fb33a84d0 100644 (file)
@@ -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<int> &Position() { return position; }
-       const geometry::Vector<int> &Position() const { return position; }
+       math::Vector<int> &Position() { return position; }
+       const math::Vector<int> &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<int> position;
+       math::Vector<int> position;
        AttackChoice attackChoice;
        common::Stats stats;
 
index bf02f0309ee5865cf2efae1735dfcabb0c6ad629..da2c86662de617210c982357f41bb1c00a618bad 100644 (file)
@@ -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<int> &Position() { return position; }
-       const geometry::Vector<int> &Position() const { return position; }
+       math::Vector<int> &Position() { return position; }
+       const math::Vector<int> &Position() const { return position; }
 
        graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
        const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
@@ -89,7 +89,7 @@ private:
 
        graphics::AnimationRunner animation;
 
-       geometry::Vector<int> position;
+       math::Vector<int> position;
 
        graphics::Menu<const common::Spell *> spellMenu;
        graphics::Menu<const common::Item *> ikariMenu;
index 7c8769af048986f2d7f8dcd57ee0cc8415c85cb7..6dc5e86fa11d261063def6720f0bd6b82ed73e59 100644 (file)
@@ -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 {
index ddade4d6dcb2431ed85dce16f612dbe142995523..24c8f8a6da4109c4e564023d9f1211cd83e98a0b 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "fwd.h"
 #include "Hero.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include "../graphics/fwd.h"
 
 #include <SDL.h>
@@ -19,9 +19,9 @@ public:
 
 public:
        const graphics::Sprite *HeroSprite() const;
-       geometry::Vector<int> HeroOffset() const;
+       math::Vector<int> HeroOffset() const;
 
-       void Render(SDL_Surface *screen, int width, int height, const geometry::Vector<int> &position, bool active) const;
+       void Render(SDL_Surface *screen, int width, int height, const math::Vector<int> &position, bool active) const;
 
 private:
        const BattleState *battle;
index 8d68085642ec9fce454b5fe56cd2cfd97901c017..bb44bb48ed2ce525b4612811ab49790f683e5868 100644 (file)
@@ -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<int> &Position() { return position; }
-       const geometry::Vector<int> &Position() const { return position; }
+       math::Vector<int> &Position() { return position; }
+       const math::Vector<int> &Position() const { return position; }
 
 // temporary setters until loader is implemented
 public:
@@ -93,7 +93,7 @@ private:
 
        graphics::AnimationRunner animation;
 
-       geometry::Vector<int> position;
+       math::Vector<int> position;
 
        AttackChoice attackChoice;
 
index 1b49f01cb014cc817e43d71f19c7050e2c44a6ca..acbce64f6ba01833790b32972d1aaa93cd0bf14f 100644 (file)
@@ -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<int> &position) {
+void MoveMenu::Render(SDL_Surface *screen, const math::Vector<int> &position) {
        Vector<int> attackOffset(0, IconHeight());
        Vector<int> changeOffset(0, 0);
        Vector<int> runOffset(0, 2 * IconHeight());
index 2a9ee7c96a05220ef542db8fadcabe4a505f1449..6a177ef4b5b49309ae807c476bb5f23b037e51fb 100644 (file)
@@ -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<int> &position);
+       void Render(SDL_Surface *screen, const math::Vector<int> &position);
 
        int Width() const { return IconWidth(); }
        int Height() const { return 3 * IconHeight(); }
index 63d16562f1324822d8c8eac50aa6580b54e88611..e3b27ba5dfe0e326800fda3f1ddafb1ab9800f34 100644 (file)
@@ -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;
index 16208dd8a0fcb99b7e0a193f9c7e6f6c3fa96bae..dea8bfcecc018ad7285e0f55edaefde8782d29fa 100644 (file)
@@ -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<int> &position) const;
+       void Draw(SDL_Surface *dest, const math::Vector<int> &position) const;
 
 private:
        int number;
index bf8b3e8623d3d6d3987d6ba3075b264aa32d8a6d..e46b276d685b038efe2ce04bbf9f07295c40827e 100644 (file)
@@ -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;
index f5cd03d924e496ce867a1369c49b1fbfaaec2622..ec12f4dda9764a3859efdef806bf9fdc6da96a28 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BATTLE_PARTYLAYOUT_H_
 #define BATTLE_PARTYLAYOUT_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <cassert>
 #include <vector>
@@ -18,12 +18,12 @@ public:
        PartyLayout() : positions(0), numPositions(0) { }
 
 public:
-       std::vector<geometry::Vector<int> >::size_type NumPositions() const { return numPositions; }
-       void CalculatePositions(int width, int height, std::vector<geometry::Vector<int> > &dest) const;
-       geometry::Vector<int> CalculatePosition(int index, int width, int height) const;
+       std::vector<math::Vector<int> >::size_type NumPositions() const { return numPositions; }
+       void CalculatePositions(int width, int height, std::vector<math::Vector<int> > &dest) const;
+       math::Vector<int> CalculatePosition(int index, int width, int height) const;
 
 public:
-       void SetPositions(const geometry::Vector<int> *p, int num) {
+       void SetPositions(const math::Vector<int> *p, int num) {
                positions = p;
                numPositions = num;
        }
@@ -32,7 +32,7 @@ public:
        static void Construct(void *);
 
 private:
-       const geometry::Vector<int> *positions;
+       const math::Vector<int> *positions;
        int numPositions;
 
 };
index 265f230642e58d36e3b53c78be83863221c65067..1496d47f3c336c836069eb4158f1669f2f714315 100644 (file)
@@ -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<int> &position) const {
+void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, const math::Vector<int> &position) const {
        const Resources &r(battle->Res());
        const Frame *frame((index == battle->MaxHeroes() - 1) ? r.lastSmallHeroTagFrame : r.smallHeroTagFrame);
        const Font *font(r.normalFont);
index 69a6f5c547cf7bb591613569b72d9bf54c036727..7c038017fab49d156ba60083010e9eeba3fed86a 100644 (file)
@@ -2,7 +2,7 @@
 #define BATTLE_SMALLHEROTAG_H_
 
 #include "fwd.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include "../graphics/fwd.h"
 
 #include <SDL.h>
@@ -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<int> &position) const;
+       void Render(SDL_Surface *screen, int width, int height, const math::Vector<int> &position) const;
 
 private:
        const BattleState *battle;
index 43414eb89a60d86e7964ad2f63861da7818f5b8e..f930de955b39a72da9c3255e17d5ec5c162c3c23 100644 (file)
@@ -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<int> &offse
        }
 }
 
-void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const math::Vector<int> &offset) const {
        if (!targetAnimation.Valid() || !targetAnimation.Running()) return;
        const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection());
        if (ts.TargetsHeroes()) {
index b8623698f5734715b3818c0fe6d375fa9a1b437c..de20f76cbeaa267ccd5f6a08eb96f0a3094f4dce 100644 (file)
@@ -11,7 +11,7 @@
 #include "../../app/State.h"
 
 #include "../NumberAnimation.h"
-#include "../../geometry/Vector.h"
+#include "../../math/Vector.h"
 #include "../../graphics/Animation.h"
 
 #include <vector>
@@ -49,9 +49,9 @@ private:
 private:
        void AddNumberAnimations(const TargetSelection &);
 
-       void RenderTitleBar(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderNumbers(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderTitleBar(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderNumbers(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderTargetAnimation(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        BattleState *battle;
@@ -61,7 +61,7 @@ private:
        app::Timer<Uint32> titleBarTimer;
        app::Timer<Uint32> targetAnimationTimer;
        std::vector<NumberAnimation> numberAnimation;
-       std::vector<geometry::Vector<int> > numberPosition;
+       std::vector<math::Vector<int> > numberPosition;
        int cursor;
 
 };
index 311e0f35c3cc8b8c7aba89350901da1c762a3e92..afbbe5321cd015c17f1dabcd56afb3e508786e94 100644 (file)
@@ -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 {
 
index cf91f9ab47796eb0659223093526b3f0a61d6bb0..cdf7881c9d48d9be2235173625bfde731ae92db6 100644 (file)
@@ -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<int> &offset);
+       void RenderTitleBar(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index fade2326d305ff815f1c1cd4a55241e47d8bb273..9f6e561be43fadea59adcd44eeec6ea0ea022a65 100644 (file)
@@ -23,7 +23,7 @@
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Vector;
+using math::Vector;
 
 namespace battle {
 
index 64a7dbd9414b615ba9cbec40d3c30cb36ac3d283..c096fa02a5b70903ad057c2998f60ee7b407415f 100644 (file)
@@ -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<int> &offset);
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index 2860a81afa7977ec5905b5b1356f63469ac6775a..4bfea03d749142430489cdbc456d1279d147d03d 100644 (file)
@@ -19,7 +19,7 @@
 using app::Application;
 using app::Input;
 using common::Ikari;
-using geometry::Vector;
+using math::Vector;
 using graphics::Frame;
 
 namespace battle {
index 8603a57f5f3258f657d588cbbbd7a8f401673d03..ca08732e5ffe8a25b98bfe547c7cee6f49f9d666 100644 (file)
@@ -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<int> &offset);
-       void RenderHeadline(SDL_Surface *, const geometry::Vector<int> &offset);
-       void RenderMenu(SDL_Surface *, const geometry::Vector<int> &offset);
+       void RenderFrame(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderHeadline(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderMenu(SDL_Surface *, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index 6ca43960ac1277c31fa0b48cdb054278150abb2e..b64311640020055369f1d692726799c324d3d302 100644 (file)
@@ -18,7 +18,7 @@
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Vector;
+using math::Vector;
 using graphics::Frame;
 
 namespace battle {
index 1942ff405e74e98460f7f0a3dacbed4e354d6847..97863e21b97c32ea40f78ea44720fa0387a676fa 100644 (file)
@@ -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<int> &offset);
-       void RenderHeadline(SDL_Surface *, const geometry::Vector<int> &offset);
-       void RenderMenu(SDL_Surface *, const geometry::Vector<int> &offset);
+       void RenderFrame(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderHeadline(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderMenu(SDL_Surface *, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index 52b670b5d941d019b1132884a40af89557c83763..74e86281c3761097bc75e149e41ce51fed696c7c 100644 (file)
@@ -17,7 +17,7 @@
 
 using app::Application;
 using app::Input;
-using geometry::Vector;
+using math::Vector;
 
 namespace battle {
 
index a48633d6dc7434b8ea754cf51c60eae5463d7d7b..069f98d864aedb97b0cc0d7f4ba9170db3af4e5e 100644 (file)
@@ -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<int> &offset);
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index d7941c8e917212c58753a2b645e6b5875ebf37d1..e15fa2e5490710579ebda387b6bcdf436a392b52 100644 (file)
@@ -19,7 +19,7 @@
 using app::Application;
 using app::Input;
 using common::Spell;
-using geometry::Vector;
+using math::Vector;
 using graphics::Frame;
 
 namespace battle {
index 514a2b8a6b55175ad1ce5e596b4d9e458190ac00..93734a3ded582857e5202a835d3fc40b37dc32f6 100644 (file)
@@ -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<int> &offset);
-       void RenderHeadline(SDL_Surface *, const geometry::Vector<int> &offset);
-       void RenderMenu(SDL_Surface *, const geometry::Vector<int> &offset);
+       void RenderFrame(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderHeadline(SDL_Surface *, const math::Vector<int> &offset);
+       void RenderMenu(SDL_Surface *, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index 1961738623a30a1c9f3ec2f90c340c3a651f4dbe..1644c2e8d18f9bebee856d9bc6b8754094e5a9f1 100644 (file)
@@ -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<int> &offset) {
+void SelectTarget::RenderCursors(SDL_Surface *screen, const math::Vector<int> &offset) {
        Vector<int> cursorOffset(cursorIcon->Width() / -2, cursorIcon->Height());
        // offset the indicator by 1/8th to the right and top
        Vector<int> indicatorOffset(cursorOffset + Vector<int>(cursorIcon->Width() / 8, cursorIcon->Height() / -8));
index 388aef3544cfb99e0d0729342937762b5509023c..542e0e46449c0179bdc224cfb0bb549b6aaeea16 100644 (file)
@@ -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<int> &offset);
+       void RenderCursors(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index 357e324eced45ea995c1a0f45e23b9aa0cacba40..9bde2b39202a1196c632690ecc5ff216083fbf6a 100644 (file)
@@ -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<int> &offset) {
+void SwapHeroes::RenderCursors(SDL_Surface *screen, const math::Vector<int> &offset) {
        // offset the cursor by 1/8th to the left and bottom
        Vector<int> cursorOffset(battle->Res().swapCursor->Width() / -8, battle->Res().swapCursor->Height() / 8);
        Vector<int> indicatorOffset(0, 0);
index 198e4d3d1504d0a99aa78471ee7d51b2123bb3c7..14d0d723c9611dca6a96db884a2ed0b6135329b3 100644 (file)
@@ -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<int> &offset);
+       void RenderCursors(SDL_Surface *screen, const math::Vector<int> &offset);
 
 private:
        BattleState *battle;
index bf99cfa1ad376660c322c97640515ec9b71f4dce..d54394fdb7748ed3a56afc57e806565eb554b9ca 100644 (file)
@@ -10,7 +10,7 @@ namespace graphics {
 }
 
 #include "../common/Stats.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -39,7 +39,7 @@ public:
        int MaxClass() const { return maxClass; }
        int CurrentClass() const { return curClass; }
 
-       const geometry::Vector<int> &AlignmentOffset() const { return alignmentCursor; }
+       const math::Vector<int> &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<int> alignmentCursor;
+       math::Vector<int> alignmentCursor;
        const graphics::Sprite *alignmentSprite;
 
        int maxHealth;
index 8f1ad2a34e1af72aa9d8ad5163b3d3833adf3b9a..947ded712b5a59912552b6de19593190dfbbe5f6 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <cstdlib>
 
-using geometry::Vector;
+using math::Vector;
 
 namespace common {
 
index 7a8aa2cf7f1e0e4f0a0ec44749cf73d7ec352a5a..67931c1323f18f49a6e802b54c7c79586ba3a613 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "fwd.h"
 #include "Script.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -21,7 +21,7 @@ public:
 
        void *AddressRegister(int n) const { return address[n]; }
        int IntegerRegister(int n) const { return integer[n]; }
-       const geometry::Vector<int> &VectorRegister(int n) const { return vector[n]; }
+       const math::Vector<int> &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<int> &PopVector();
+       const math::Vector<int> &PopVector();
 
        void Compare(int, int);
 
@@ -48,7 +48,7 @@ private:
        static const int numRegisters = 7;
        void *address[numRegisters];
        int integer[numRegisters];
-       geometry::Vector<int> vector[numRegisters];
+       math::Vector<int> vector[numRegisters];
 
        Uint8 compare;
 
diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h
deleted file mode 100644 (file)
index 8822b1b..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#ifndef GEOMETRY_VECTOR_H_
-#define GEOMETRY_VECTOR_H_
-
-#include <cmath>
-#include <limits>
-#include <ostream>
-
-namespace geometry {
-
-/// Basic vector class with emphasis on graphical/computational ease of use
-/// rather than mathematical accuracy ;) .
-template<class Scalar>
-class Vector {
-
-public:
-       Vector() : x(0), y(0) { }
-       Vector(Scalar x, Scalar y) : x(x), y(y) { }
-       template<class T>
-       Vector(const Vector<T> &other) : x(other.X()), y(other.Y()) { };
-       template<class T>
-       Vector(T x, T y) : x(x), y(y) { }
-
-public:
-       Scalar X() const { return x; }
-       Scalar Y() const { return y; }
-
-       Scalar &X() { return x; }
-       Scalar &Y() { return y; }
-
-       Scalar Index(Scalar lineLength) const { return Y() * lineLength + X(); }
-       static Vector<Scalar> FromIndex(Scalar index, Scalar lineLength) {
-               return Vector<Scalar>(index % lineLength, index / lineLength);
-       }
-
-       void Lock(const Vector<Scalar> &to);
-
-private:
-       Scalar x, y;
-
-};
-
-
-template<class T>
-inline Vector<T> operator +(const Vector<T> &lhs, const Vector<T> &rhs) {
-       return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
-}
-template<class T, class U>
-inline Vector<T> operator +(const Vector<T> &lhs, const Vector<U> &rhs) {
-       return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
-}
-
-template<class T>
-inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<T> &rhs) {
-       return lhs = lhs + rhs;
-}
-template<class T, class U>
-inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<U> &rhs) {
-       return lhs = lhs + rhs;
-}
-
-template<class T>
-inline Vector<T> operator -(const Vector<T> &lhs, const Vector<T> &rhs) {
-       return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
-}
-template<class T, class U>
-inline Vector<T> operator -(const Vector<T> &lhs, const Vector<U> &rhs) {
-       return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
-}
-
-template<class T>
-inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<T> &rhs) {
-       return lhs = lhs - rhs;
-}
-template<class T, class U>
-inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<U> &rhs) {
-       return lhs = lhs - rhs;
-}
-
-template<class T>
-inline Vector<T> operator -(const Vector<T> &v) {
-       return Vector<T>(-v.X(), -v.Y());
-}
-
-template<class T>
-inline Vector<T> operator *(const Vector<T> &v1, const Vector<T> &v2) {
-       return Vector<T>(v1.X() * v2.X(), v1.Y() * v2.Y());
-}
-template<class T>
-inline Vector<T> operator *(const Vector<T> &v, T s) {
-       return Vector<T>(v.X() * s, v.Y() * s);
-}
-template<class T>
-inline Vector<T> operator *(T s, const Vector<T> &v) {
-       return Vector<T>(s * v.X(), s * v.Y());
-}
-
-template<class T>
-inline Vector<T> operator /(const Vector<T> &v1, const Vector<T> &v2) {
-       return Vector<T>(v1.X() / v2.X(), v1.Y() / v2.Y());
-}
-template<class T>
-inline Vector<T> operator /(const Vector<T> &v, T s) {
-       return Vector<T>(v.X() / s, v.Y() / s);
-}
-template<class T>
-inline Vector<T> operator /(T s, const Vector<T> &v) {
-       return Vector<T>(s / v.X(), s / v.Y());
-}
-
-template<class T>
-inline Vector<T> operator %(const Vector<T> &v1, const Vector<T> &v2) {
-       return Vector<T>(v1.X() % v2.X(), v1.Y() % v2.Y());
-}
-template<>
-inline Vector<float> operator %(const Vector<float> &v1, const Vector<float> &v2) {
-       return Vector<float>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
-}
-template<>
-inline Vector<double> operator %(const Vector<double> &v1, const Vector<double> &v2) {
-       return Vector<double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
-}
-template<>
-inline Vector<long double> operator %(const Vector<long double> &v1, const Vector<long double> &v2) {
-       return Vector<long double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
-}
-template<class T>
-inline Vector<T> operator %(const Vector<T> &v, T s) {
-       return Vector<T>(v.X() % s, v.Y() % s);
-}
-template<>
-inline Vector<float> operator %(const Vector<float> &v, float s) {
-       return Vector<float>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
-}
-template<>
-inline Vector<double> operator %(const Vector<double> &v, double s) {
-       return Vector<double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
-}
-template<>
-inline Vector<long double> operator %(const Vector<long double> &v, long double s) {
-       return Vector<long double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
-}
-
-template<class T>
-inline bool operator ==(const Vector<T> &lhs, const Vector<T> &rhs) {
-       return lhs.X() == rhs.X() && lhs.Y() == rhs.Y();
-}
-
-template<class T>
-inline bool operator !=(const Vector<T> &lhs, const Vector<T> &rhs) {
-       return lhs.X() != rhs.X() || lhs.Y() != rhs.Y();
-}
-
-template<class T>
-inline std::ostream &operator <<(std::ostream &out, const Vector<T> &v) {
-       out << '<' << v.X() << ", " << v.Y() << '>';
-       return out;
-}
-
-
-template <class Scalar>
-void Vector<Scalar>::Lock(const Vector<Scalar> &to) {
-       Vector<Scalar> half(to / Scalar(2));
-       Vector<Scalar> dist((*this) % to);
-
-       if (dist.X() > half.X()) {
-               x += (to.X() - dist.X());
-       } else {
-               x -= dist.X();
-       }
-
-       if (dist.Y() > half.Y()) {
-               y += (to.Y() - dist.Y());
-       } else {
-               y -= dist.Y();
-       }
-}
-
-
-}
-
-#endif /* GEOMETRY_VECTOR_H_ */
diff --git a/src/geometry/fwd.h b/src/geometry/fwd.h
deleted file mode 100644 (file)
index d8fa4a0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef GEOMERTY_FWD_H_
-#define GEOMERTY_FWD_H_
-
-namespace geometry {
-
-template<class Scalar>
-class Vector;
-
-}
-
-#endif /* GEOMERTY_FWD_H_ */
index f55a9aa9fc6520b7c46e1532f8c83fccd9dece55..602d7ef5d7613ada5118239b3ebf870e381633fc 100644 (file)
@@ -63,24 +63,24 @@ bool AnimationRunner::JustFinished() const {
 }
 
 
-void AnimationRunner::Draw(SDL_Surface *dest, geometry::Vector<int> position) const {
+void AnimationRunner::Draw(SDL_Surface *dest, math::Vector<int> 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<int> position) const {
-       geometry::Vector<int> offset(-GetSprite()->Width(), 0);
+void AnimationRunner::DrawTopRight(SDL_Surface *dest, math::Vector<int> position) const {
+       math::Vector<int> offset(-GetSprite()->Width(), 0);
        Draw(dest, position + offset);
 }
 
-void AnimationRunner::DrawCenter(SDL_Surface *dest, geometry::Vector<int> position) const {
+void AnimationRunner::DrawCenter(SDL_Surface *dest, math::Vector<int> position) const {
        Draw(dest, position - (GetSprite()->Size() / 2));
 }
 
-void AnimationRunner::DrawCenterBottom(SDL_Surface *dest, geometry::Vector<int> position) const {
-       geometry::Vector<int> offset(-GetSprite()->Width() / 2, -GetSprite()->Height());
+void AnimationRunner::DrawCenterBottom(SDL_Surface *dest, math::Vector<int> position) const {
+       math::Vector<int> offset(-GetSprite()->Width() / 2, -GetSprite()->Height());
        Draw(dest, position + offset);
 }
 
index 79bfa852b887f02316afad317a5bfdd912348eb5..f70379daf45603b9cc53e4c08c0f2c958e838ca4 100644 (file)
@@ -10,7 +10,7 @@ namespace loader {
 }
 
 #include "../app/Timer.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <memory>
 #include <SDL.h>
@@ -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<int> Offset(int frame) const { return geometry::Vector<int>(); }
+       virtual math::Vector<int> Offset(int frame) const { return math::Vector<int>(); }
 
        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<int> position) const;
-       void DrawTopRight(SDL_Surface *dest, geometry::Vector<int> position) const;
-       void DrawCenter(SDL_Surface *dest, geometry::Vector<int> position) const;
-       void DrawCenterBottom(SDL_Surface *dest, geometry::Vector<int> position) const;
+       void Draw(SDL_Surface *dest, math::Vector<int> position) const;
+       void DrawTopRight(SDL_Surface *dest, math::Vector<int> position) const;
+       void DrawCenter(SDL_Surface *dest, math::Vector<int> position) const;
+       void DrawCenterBottom(SDL_Surface *dest, math::Vector<int> position) const;
 
        int Frame() const;
 
index 6039586ffb7eca0caa7be2703753b977ea9f54a1..ee87e3f6f107e6cc4f314cbf47acf69d74c15280 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <cassert>
 
-using geometry::Vector;
+using math::Vector;
 
 namespace graphics {
 
index 49d0e46d7823396272f0ffef91b53bec621e43c4..6067baba68e4b5c2cdc8f11e103ce7e152f38b72 100644 (file)
@@ -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<float> *target);
+       Camera(int width, int height, const math::Vector<float> *target);
        ~Camera() { }
 
 public:
        void Resize(int w, int h) { halfWidth = w / 2; halfHeight = h / 2; }
-       void SetTarget(const geometry::Vector<float> *t);
+       void SetTarget(const math::Vector<float> *t);
 
-       geometry::Vector<int> CalculateOffset() const;
+       math::Vector<int> CalculateOffset() const;
 
 private:
-       const geometry::Vector<float> *target;
+       const math::Vector<float> *target;
        int halfWidth;
        int halfHeight;
 
index 415c7a623f9247db2f9e26ae23d34f25d276b961..a07563b3266daf23044596b36ea652cebe98b8d8 100644 (file)
@@ -7,7 +7,7 @@
 
 #include <cstring>
 
-using geometry::Vector;
+using math::Vector;
 using loader::FieldDescription;
 using loader::Interpreter;
 using loader::TypeDescription;
index c5d4cd8e844636aec27403d840a350ad835282b1..6859dfe82980c21ae8a4414ff2febf8a0346ec51 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GRAPHICS_CHARSELECT_H_
 #define GRAPHICS_CHARSELECT_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -18,7 +18,7 @@ public:
        static const int TYPE_ID = 411;
 
 public:
-       void Draw(SDL_Surface *screen, const geometry::Vector<int> &position) const;
+       void Draw(SDL_Surface *screen, const math::Vector<int> &position) const;
 
        void NextCol();
        void PreviousCol();
index bd2eaf8732b7044b28a1d770d87539301a4f474a..c1b88c18d789aa2c7fb847331fb6b07a8c326be8 100644 (file)
@@ -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;
index eeeef680d37b558a8a06ebaa226c2b0d9d85ed4d..1ed001aa341bdc6f915c5d1476f04a8d51d1acdd 100644 (file)
@@ -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<int> &disposition)
+               FrameProp(int col, int row, const math::Vector<int> &disposition)
                : col(col), row(row), disposition(disposition) {}
                int col;
                int row;
-               geometry::Vector<int> disposition;
+               math::Vector<int> 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<int> Offset(int frame) const;
+       virtual math::Vector<int> Offset(int frame) const;
 
 private:
        const FrameProp *frames;
index 069d0325f90ffd124bfd9b9d9eb63ad621d528ac..9b415514f44f185c3a147580f4721d0470cc1b77 100644 (file)
@@ -7,7 +7,7 @@
 #include <cstring>
 #include <iostream>
 
-using geometry::Vector;
+using math::Vector;
 using loader::FieldDescription;
 using loader::Interpreter;
 using loader::TypeDescription;
index c879dcedf73e4fc8a6803cac9651e1e7c0e538af..272b09fa857144e7e9acb6c9a6df824f9e162cf9 100644 (file)
@@ -2,7 +2,7 @@
 #define GRAPHICS_FONT_H_
 
 #include "Sprite.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -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<int> &position) const;
-       void DrawString(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxWidth = 0) const;
-       void DrawStringRight(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxWidth = 0) const;
-       void DrawDigit(int d, SDL_Surface *dest, const geometry::Vector<int> &position) const;
-       void DrawNumber(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
-       void DrawNumberRight(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
+       void DrawChar(char c, SDL_Surface *dest, const math::Vector<int> &position) const;
+       void DrawString(const char *s, SDL_Surface *dest, const math::Vector<int> &position, int maxWidth = 0) const;
+       void DrawStringRight(const char *s, SDL_Surface *dest, const math::Vector<int> &position, int maxWidth = 0) const;
+       void DrawDigit(int d, SDL_Surface *dest, const math::Vector<int> &position) const;
+       void DrawNumber(int n, SDL_Surface *dest, const math::Vector<int> &position, int digits = 0) const;
+       void DrawNumberRight(int n, SDL_Surface *dest, const math::Vector<int> &position, int digits = 0) const;
 
 public:
        void SetSprite(const Sprite *s) { sprite = s; }
index dbfd814067c95668860d6e34107684a06636e748..f9d88253a440bd1e0b9f7d8b4756c4554e1332ff 100644 (file)
@@ -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;
index 62c052d0765d168686d4d452a6868bf77c6ed0fe..023b694785678123d6f93d10cc7e26523e2a778f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GRAPHICS_FRAME_H_
 #define GRAPHICS_FRAME_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -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<int> BorderSize() const { return borderSize; }
+       const math::Vector<int> BorderSize() const { return borderSize; }
        int RepeatWidth() const { return RepeatSize().X(); }
        int RepeatHeight() const { return RepeatSize().Y(); }
-       const geometry::Vector<int> RepeatSize() const { return repeatSize; }
-       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int width, int height) const;
+       const math::Vector<int> RepeatSize() const { return repeatSize; }
+       void Draw(SDL_Surface *dest, const math::Vector<int> &position, int width, int height) const;
 
 public:
        void SetSurface(SDL_Surface *s) { surface = s; }
-       void SetBorderSize(const geometry::Vector<int> &s) { borderSize = s; }
-       void SetRepeatSize(const geometry::Vector<int> &s) { repeatSize = s; }
-       void SetOffset(const geometry::Vector<int> &o) { offset = o; }
+       void SetBorderSize(const math::Vector<int> &s) { borderSize = s; }
+       void SetRepeatSize(const math::Vector<int> &s) { repeatSize = s; }
+       void SetOffset(const math::Vector<int> &o) { offset = o; }
 
        static void CreateTypeDescription();
        static void Construct(void *);
 
 private:
        SDL_Surface *surface;
-       geometry::Vector<int> borderSize;
-       geometry::Vector<int> repeatSize;
-       geometry::Vector<int> offset;
+       math::Vector<int> borderSize;
+       math::Vector<int> repeatSize;
+       math::Vector<int> offset;
 
 };
 
index 7e20567eceab33dd606421012de24f1a8920550e..d5b41b545ee9e01be194d551e839782c3f6e199f 100644 (file)
@@ -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;
index 59a7490961da5c3c92b161d134aed3c1d8220d93..383559e746add0ccfab0cb9617d50e7ca66546b3 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GRAPHICS_GAUGE_H_
 #define GRAPHICS_GAUGE_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -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<int> &position, int width, Uint8 fill) const;
+       void Draw(SDL_Surface *dest, const math::Vector<int> &position, int width, Uint8 fill) const;
 
 public:
        void SetSurface(SDL_Surface *s) { surface = s; }
-       void SetFullOffset(const geometry::Vector<int> &o) { fullOffset = o; }
-       void SetEmptyOffset(const geometry::Vector<int> &o) { emptyOffset = o; }
+       void SetFullOffset(const math::Vector<int> &o) { fullOffset = o; }
+       void SetEmptyOffset(const math::Vector<int> &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<int> fullOffset;
-       geometry::Vector<int> emptyOffset;
+       math::Vector<int> fullOffset;
+       math::Vector<int> emptyOffset;
        int height;
        int startWidth;
        int repeatWidth;
index d83b2a5e9b540801b88128b77f4d41002bc36521..91cc3a7cbbe6431a7021a4611c82dd59c54eb255 100644 (file)
@@ -4,7 +4,7 @@
 #include "Font.h"
 #include "fwd.h"
 #include "Sprite.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <algorithm>
 #include <vector>
@@ -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<int> &position) const;
+       void Draw(SDL_Surface *dest, const math::Vector<int> &position) const;
 
 private:
        int GetRow(int index) const { return index / cols; }
@@ -231,51 +231,51 @@ void Menu<T>::SelectIndex(int index) {
 
 
 template<class T>
-void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) const {
+void Menu<T>::Draw(SDL_Surface *dest, const math::Vector<int> &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<int> iconOffset(
+               math::Vector<int> 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<int>(font->CharWidth() * thirdColumnHack, 0);
+                       iconOffset += math::Vector<int>(font->CharWidth() * thirdColumnHack, 0);
                }
 
                if (entries[start + i].icon) {
                        entries[start + i].icon->Draw(dest, position + iconOffset);
                }
-               geometry::Vector<int> textOffset(iconOffset.X() + iconSpace, iconOffset.Y());
+               math::Vector<int> 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<int>(charsPerEntry * usedFont->CharWidth(), 0);
+               textOffset += math::Vector<int>(charsPerEntry * usedFont->CharWidth(), 0);
 
                if (charsPerAdditionalText) {
-                       textOffset += geometry::Vector<int>(additionalTextGap, 0);
+                       textOffset += math::Vector<int>(additionalTextGap, 0);
                        if (entries[start + i].additionalText) {
                                usedFont->DrawString(entries[start + i].additionalText, dest, position + textOffset, charsPerAdditionalText);
                        }
-                       textOffset += geometry::Vector<int>(charsPerAdditionalText * usedFont->CharWidth(), 0);
+                       textOffset += math::Vector<int>(charsPerAdditionalText * usedFont->CharWidth(), 0);
                }
 
                if (charsPerNumber) {
                        usedFont->DrawChar(delimiter, dest, position + textOffset);
-                       textOffset += geometry::Vector<int>(usedFont->CharWidth(), 0);
+                       textOffset += math::Vector<int>(usedFont->CharWidth(), 0);
                        usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset, charsPerNumber);
                }
        }
-       geometry::Vector<int> cursorOffset(
+       math::Vector<int> 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<int>(font->CharWidth() * thirdColumnHack, 0);
+               cursorOffset += math::Vector<int>(font->CharWidth() * thirdColumnHack, 0);
        }
        switch (state) {
                case STATE_INACTIVE:
@@ -288,9 +288,9 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
                        break;
                case STATE_DUAL:
                        cursor->Draw(dest, position + cursorOffset
-                                       - geometry::Vector<int>(selectedCursor->Width(), 0));
+                                       - math::Vector<int>(selectedCursor->Width(), 0));
                        if (secondarySelection >= start && secondarySelection <= end) {
-                               geometry::Vector<int> secondaryOffset(
+                               math::Vector<int> secondaryOffset(
                                                (secondarySelection % cols) * (ColWidth() + colGap) - cursor->Width(),
                                                ((secondarySelection - start) / cols) * RowHeight());
                                selectedCursor->Draw(dest, position + secondaryOffset);
index d74bd0d404b8d1e18ff77262ebefc81c19e6c839..1b858308b46d0f47f3c536a3f0baa5aea7734b49 100644 (file)
@@ -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;
index 6e248ff556f08f94279f01f124797f31f6e2655b..8aa52085a6e30bda486a489ec0e9cb2c0cf45b38 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GRAPHICS_SPRITE_H_
 #define GRAPHICS_SPRITE_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -20,32 +20,32 @@ public:
 public:
        int Width() const { return size.X(); }
        int Height() const { return size.Y(); }
-       const geometry::Vector<int> &Size() const { return size; }
-       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const;
-       void DrawTopRight(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
-               geometry::Vector<int> offset(-Width(), 0);
+       const math::Vector<int> &Size() const { return size; }
+       void Draw(SDL_Surface *dest, const math::Vector<int> &position, int col = 0, int row = 0) const;
+       void DrawTopRight(SDL_Surface *dest, const math::Vector<int> &position, int col = 0, int row = 0) const {
+               math::Vector<int> offset(-Width(), 0);
                Draw(dest, position + offset, col, row);
        }
-       void DrawCenter(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
+       void DrawCenter(SDL_Surface *dest, const math::Vector<int> &position, int col = 0, int row = 0) const {
                Draw(dest, position - (Size() / 2), col, row);
        }
-       void DrawCenterBottom(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
-               geometry::Vector<int> offset(-Width() / 2, -Height());
+       void DrawCenterBottom(SDL_Surface *dest, const math::Vector<int> &position, int col = 0, int row = 0) const {
+               math::Vector<int> offset(-Width() / 2, -Height());
                Draw(dest, position + offset, col, row);
        }
 
 public:
        void SetSurface(SDL_Surface *s) { surface = s; }
-       void SetSize(const geometry::Vector<int> &s) { size = s; }
-       void SetOffset(const geometry::Vector<int> &o) { offset = o; }
+       void SetSize(const math::Vector<int> &s) { size = s; }
+       void SetOffset(const math::Vector<int> &o) { offset = o; }
 
        static void CreateTypeDescription();
        static void Construct(void *);
 
 private:
        SDL_Surface *surface;
-       geometry::Vector<int> size;
-       geometry::Vector<int> offset;
+       math::Vector<int> size;
+       math::Vector<int> offset;
 
 };
 
index f53c82fd7030f6219332e5368ae1d435b4a4481e..db45b3d9d13d3d329dd0f13f39276421cfe5fca8 100644 (file)
@@ -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;
index bd85aaafb1fe5d4b9258e30894b7888b5af6db19..0de987a3d6355ab9f46386183c7b4326db9705c9 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GRAPHICS_TEXTURE_H_
 #define GRAPHICS_TEXTURE_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -12,27 +12,27 @@ class Texture {
 public:
        explicit Texture(
                        SDL_Surface *surface = 0,
-                       const geometry::Vector<int> &size = geometry::Vector<int>(),
-                       const geometry::Vector<int> &offset = geometry::Vector<int>());
+                       const math::Vector<int> &size = math::Vector<int>(),
+                       const math::Vector<int> &offset = math::Vector<int>());
        ~Texture();
 
        static const int TYPE_ID = 410;
 
 public:
-       void Render(SDL_Surface *dest, const geometry::Vector<int> &from, const geometry::Vector<int> &to) const;
+       void Render(SDL_Surface *dest, const math::Vector<int> &from, const math::Vector<int> &to) const;
 
 public:
        void SetSurface(SDL_Surface *s) { surface = s; }
-       void SetSize(const geometry::Vector<int> &s) { size = s; }
-       void SetOffset(const geometry::Vector<int> &o) { offset = o; }
+       void SetSize(const math::Vector<int> &s) { size = s; }
+       void SetOffset(const math::Vector<int> &o) { offset = o; }
 
        static void CreateTypeDescription();
        static void Construct(void *);
 
 private:
        SDL_Surface *surface;
-       geometry::Vector<int> size;
-       geometry::Vector<int> offset;
+       math::Vector<int> size;
+       math::Vector<int> offset;
 
 };
 
index e64110dbf7175801cbd2cde01aea701ce874d4d1..46b4bc35198f5e337329a8dc71710c5157e1d3ce 100644 (file)
@@ -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;
index fc1499dbd807c10eff793ee7b34a3506db8df640..5707959e49265d52b66ecd075ac64d569b7dc44c 100644 (file)
@@ -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"
index 7bde641ebba369596f215c779e7ed80e543d2ed3..a890871fb4c162dd12399ff1baa0190f5a6d7dc8 100644 (file)
@@ -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;
index a64dab2a928ea1b479860ee1f1220ff7623bcf76..2c7f1b8b7987d50fc477b7b8f5c3af501899344b 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <stdexcept>
 
-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<int> &offset) {
+Tile *Area::TileAt(const math::Vector<int> &offset) {
        int tileIndex(offset.Y() * width + offset.X());
        if (tileIndex < numTiles) {
                return tiles +tileIndex;
@@ -33,7 +33,7 @@ Tile *Area::TileAt(const geometry::Vector<int> &offset) {
        }
 }
 
-const Tile *Area::TileAt(const geometry::Vector<int> &offset) const {
+const Tile *Area::TileAt(const math::Vector<int> &offset) const {
        int tileIndex(offset.Y() * width + offset.X());
        if (tileIndex < numTiles) {
                return tiles +tileIndex;
index 5ea35874c8a088d9d2aae81c101a34c363c91024..90f8f5fc7b3eaf0ab2b322882b1dfa5ff7ee33dc 100644 (file)
@@ -2,7 +2,7 @@
 #define MAP_AREA_H_
 
 #include "fwd.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include "../graphics/Sprite.h"
 
 #include <SDL.h>
@@ -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<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
+       math::Vector<int> Size() const { return math::Vector<int>(Width(), Height()); }
        /// Get a tile by tile coordinates (not pixel coordinates!).
-       Tile *TileAt(const geometry::Vector<int> &);
-       const Tile *TileAt(const geometry::Vector<int> &) const;
+       Tile *TileAt(const math::Vector<int> &);
+       const Tile *TileAt(const math::Vector<int> &) 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<int> &offset) const;
-       void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
+       void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector<int> &offset) const;
+       void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector<int> &offset) const;
 
        static void CreateTypeDescription();
        static void Construct(void *);
index c2a826be0e7d6f2fc169c3b5bc856e9ade6aa3db..fd2cc686787d3474054462be551812ffe9f07ee8 100644 (file)
@@ -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<int> &tileSize) const {
+bool Entity::TileLock(const math::Vector<int> &tileSize) const {
        // TODO: change position to point to the top-left corner of a tile
        Vector<int> tilePosition(position);
        return (tilePosition.X() % tileSize.X() == 0) && (tilePosition.Y() % tileSize.Y() == 0);
index d1746c71a3cd73ff77dc37fb03de899796bdcf6f..be3197d9da4010fa6e9fc2100171c3e3d44a2f62 100644 (file)
@@ -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<float> &Position() { return position; }
-       const geometry::Vector<float> &Position() const { return position; }
+       math::Vector<float> &Position() { return position; }
+       const math::Vector<float> &Position() const { return position; }
 
        /// Velocity of the entity in pixels per second.
-       geometry::Vector<float> &Velocity() { return velocity; }
-       const geometry::Vector<float> &Velocity() const { return velocity; }
+       math::Vector<float> &Velocity() { return velocity; }
+       const math::Vector<float> &Velocity() const { return velocity; }
 
        /// Offset of the entity's sprite's to left corner relative to Position().
-       geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
-       const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
+       math::Vector<int> &SpriteOffset() { return spriteOffset; }
+       const math::Vector<int> &SpriteOffset() const { return spriteOffset; }
 
        /// Reset the entity to the stored tile coordinates (usually set when
        /// loading game data).
-       void ResetPosition(const geometry::Vector<int> &tileSize) { position = tilePosition * tileSize; }
+       void ResetPosition(const math::Vector<int> &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<int> &tileSize) const;
+       bool TileLock(const math::Vector<int> &tileSize) const;
 
        /// Integrate this entity's physical properties over given time interval.
        void Update(float deltaT);
 
-       void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
+       void Render(SDL_Surface *, const math::Vector<int> &offset) const;
 
        static void CreateTypeDescription();
        static void Construct(void *);
@@ -146,10 +146,10 @@ private:
        battle::Monster **monsters;
        int numMonsters;
        graphics::AnimationRunner runner;
-       geometry::Vector<int> spriteOffset;
-       geometry::Vector<int> tilePosition;
-       geometry::Vector<float> position;
-       geometry::Vector<float> velocity;
+       math::Vector<int> spriteOffset;
+       math::Vector<int> tilePosition;
+       math::Vector<float> position;
+       math::Vector<float> velocity;
        Orientation orientation;
        float speed;
        int flags;
index aeec93cae8b1354a43ad61cda7144a1a13940b2e..823847c92213eae625b86469ded3b80ba38a5084 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <stdexcept>
 
-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<int> &offset) const {
        }
 }
 
-Trigger *Map::TriggerAt(const geometry::Vector<int> &offset) {
+Trigger *Map::TriggerAt(const math::Vector<int> &offset) {
        // TODO: add support for multiple triggers on a tile?
        Vector<int> coords(TileCoordinates(offset));
        for (Trigger *i(triggers); i != triggers + numTriggers; ++i) {
@@ -87,7 +87,7 @@ Trigger *Map::TriggerAt(const geometry::Vector<int> &offset) {
        return 0;
 }
 
-SDL_Surface *Map::BattleBackgroundAt(const geometry::Vector<int> &position) {
+SDL_Surface *Map::BattleBackgroundAt(const math::Vector<int> &position) {
        Tile *tile(TileAt(position));
        if (tile && tile->BattleBackground()) {
                return tile->BattleBackground();
index 06caadf231661b3727864ea55e8954f42ad5a9cb..595e62b35c5926bb6776b516195d8517d575759b 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "Entity.h"
 #include "fwd.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include "../graphics/fwd.h"
 
 #include <SDL.h>
@@ -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<int> &);
-       const Area *AreaAt(const geometry::Vector<int> &) const;
+       Area *AreaAt(const math::Vector<int> &);
+       const Area *AreaAt(const math::Vector<int> &) const;
        /// Returns the Tile at given pixel coordinates or 0 if off the map.
-       Tile *TileAt(const geometry::Vector<int> &);
-       const Tile *TileAt(const geometry::Vector<int> &) const;
+       Tile *TileAt(const math::Vector<int> &);
+       const Tile *TileAt(const math::Vector<int> &) 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<int> &);
+       Trigger *TriggerAt(const math::Vector<int> &);
        /// The battle background image for this map if neither the tile nor the
        /// area has one specified.
-       SDL_Surface *BattleBackgroundAt(const geometry::Vector<int> &);
+       SDL_Surface *BattleBackgroundAt(const math::Vector<int> &);
        /// Convert coordinates pixel to tile.
-       geometry::Vector<int> TileCoordinates(const geometry::Vector<int> &) const;
+       math::Vector<int> TileCoordinates(const math::Vector<int> &) 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<int> &offset) const;
+       void Render(SDL_Surface *dest, const math::Vector<int> &offset) const;
        /// Render a debugging overlay that includes collision and trigger
        /// information.
-       void RenderDebug(SDL_Surface *dest, const geometry::Vector<int> &offset) const;
+       void RenderDebug(SDL_Surface *dest, const math::Vector<int> &offset) const;
 
        static void CreateTypeDescription();
        static void Construct(void *);
index b223f4fd6a2d4a111bb0394a39ccd10d612fa561..121dfbcdc0e41d0478d37500f906f4235902d6f2 100644 (file)
@@ -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;
 
index af66d241d40b6efe4a5a312e2b31f8735ff84559..5bbd6f856648c25bf062e2e015cf50fe2db71aeb 100644 (file)
@@ -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 <vector>
@@ -34,7 +34,7 @@ public:
 
        void SetWalkingSpeed(float s) { walkingSpeed = s; }
 
-       void Transition(Map *, const geometry::Vector<int> &coordinates);
+       void Transition(Map *, const math::Vector<int> &coordinates);
 
        virtual void HandleSyscall(common::ScriptRunner &);
 
@@ -53,7 +53,7 @@ private:
        void LoadMap(Map *);
 
        bool CheckBlocking();
-       bool CheckBlocking(const geometry::Vector<int> &position, Entity::Orientation direction) const;
+       bool CheckBlocking(const math::Vector<int> &position, Entity::Orientation direction) const;
 
        void OnTileLock();
        bool OnGridLock();
@@ -81,7 +81,7 @@ private:
        Entity *pushed;
        common::ScriptRunner runner;
        app::Timer<float> moveTimer;
-       geometry::Vector<int> lastLock;
+       math::Vector<int> lastLock;
        graphics::Camera camera;
        std::vector<Entity *> entities;
        float walkingSpeed;
index 84c740a61c8d527d5393de753773315903362803..252ede3b8788be4bf8d5900be9c3498fadb4a352 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MAP_TILE_H_
 #define MAP_TILE_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -26,7 +26,7 @@ public:
 
        SDL_Surface *BattleBackground() { return battlebg; }
 
-       const geometry::Vector<int> &Offset() const { return offset; }
+       const math::Vector<int> &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<int> &o) { offset = o; return *this; }
+       Tile &SetOffset(const math::Vector<int> &o) { offset = o; return *this; }
        Tile &SetFlags(Uint32 f) { flags = f; return *this; }
 
 private:
        SDL_Surface *battlebg;
-       geometry::Vector<int> offset;
+       math::Vector<int> offset;
        int flags;
 
 };
index dd1dbc5c9a98445ba384b5ae6201908d2bf9f8c6..7ea358898ab5c57105f054af58ccd1bddc83b85b 100644 (file)
@@ -6,7 +6,7 @@
 using app::Application;
 using app::State;
 using app::Input;
-using geometry::Vector;
+using math::Vector;
 
 namespace map {
 
index 761be8bb434af3e32454709ff48c71a706b6da33..9f2cd193a1febfbd9eec9a1c610892c2711d57c4 100644 (file)
@@ -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<int> &);
+       TransitionState(MapState *, Map *, const math::Vector<int> &);
        virtual ~TransitionState() { }
 
 public:
@@ -30,7 +30,7 @@ private:
 private:
        MapState *ms;
        Map *map;
-       const geometry::Vector<int> &coordinates;
+       const math::Vector<int> &coordinates;
 
 };
 
index 78248589ee34fa226086840dd3702ca84614327e..024b1f210e57b8714d7a67751951ef207d2fd64a 100644 (file)
@@ -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<int> &TilePosition() const { return tilePosition; }
+       const math::Vector<int> &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<int> &p) { tilePosition = p; }
+       void SetTilePosition(const math::Vector<int> &p) { tilePosition = p; }
        void SetType(Type t) { type = t; }
        void SetScript(common::Script *s) { script = s; }
 
 private:
        common::Script *script;
-       geometry::Vector<int> tilePosition;
+       math::Vector<int> tilePosition;
        int type;
 
 };
diff --git a/src/math/Vector.h b/src/math/Vector.h
new file mode 100644 (file)
index 0000000..fb07d33
--- /dev/null
@@ -0,0 +1,181 @@
+#ifndef MATH_VECTOR_H_
+#define MATH_VECTOR_H_
+
+#include <cmath>
+#include <limits>
+#include <ostream>
+
+namespace math {
+
+/// Basic vector class with emphasis on graphical/computational ease of use
+/// rather than mathematical accuracy ;) .
+template<class Scalar>
+class Vector {
+
+public:
+       Vector() : x(0), y(0) { }
+       Vector(Scalar x, Scalar y) : x(x), y(y) { }
+       template<class T>
+       Vector(const Vector<T> &other) : x(other.X()), y(other.Y()) { };
+       template<class T>
+       Vector(T x, T y) : x(x), y(y) { }
+
+public:
+       Scalar X() const { return x; }
+       Scalar Y() const { return y; }
+
+       Scalar &X() { return x; }
+       Scalar &Y() { return y; }
+
+       Scalar Index(Scalar lineLength) const { return Y() * lineLength + X(); }
+       static Vector<Scalar> FromIndex(Scalar index, Scalar lineLength) {
+               return Vector<Scalar>(index % lineLength, index / lineLength);
+       }
+
+       void Lock(const Vector<Scalar> &to);
+
+private:
+       Scalar x, y;
+
+};
+
+
+template<class T>
+inline Vector<T> operator +(const Vector<T> &lhs, const Vector<T> &rhs) {
+       return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
+}
+template<class T, class U>
+inline Vector<T> operator +(const Vector<T> &lhs, const Vector<U> &rhs) {
+       return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
+}
+
+template<class T>
+inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<T> &rhs) {
+       return lhs = lhs + rhs;
+}
+template<class T, class U>
+inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<U> &rhs) {
+       return lhs = lhs + rhs;
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &lhs, const Vector<T> &rhs) {
+       return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
+}
+template<class T, class U>
+inline Vector<T> operator -(const Vector<T> &lhs, const Vector<U> &rhs) {
+       return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
+}
+
+template<class T>
+inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<T> &rhs) {
+       return lhs = lhs - rhs;
+}
+template<class T, class U>
+inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<U> &rhs) {
+       return lhs = lhs - rhs;
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &v) {
+       return Vector<T>(-v.X(), -v.Y());
+}
+
+template<class T>
+inline Vector<T> operator *(const Vector<T> &v1, const Vector<T> &v2) {
+       return Vector<T>(v1.X() * v2.X(), v1.Y() * v2.Y());
+}
+template<class T>
+inline Vector<T> operator *(const Vector<T> &v, T s) {
+       return Vector<T>(v.X() * s, v.Y() * s);
+}
+template<class T>
+inline Vector<T> operator *(T s, const Vector<T> &v) {
+       return Vector<T>(s * v.X(), s * v.Y());
+}
+
+template<class T>
+inline Vector<T> operator /(const Vector<T> &v1, const Vector<T> &v2) {
+       return Vector<T>(v1.X() / v2.X(), v1.Y() / v2.Y());
+}
+template<class T>
+inline Vector<T> operator /(const Vector<T> &v, T s) {
+       return Vector<T>(v.X() / s, v.Y() / s);
+}
+template<class T>
+inline Vector<T> operator /(T s, const Vector<T> &v) {
+       return Vector<T>(s / v.X(), s / v.Y());
+}
+
+template<class T>
+inline Vector<T> operator %(const Vector<T> &v1, const Vector<T> &v2) {
+       return Vector<T>(v1.X() % v2.X(), v1.Y() % v2.Y());
+}
+template<>
+inline Vector<float> operator %(const Vector<float> &v1, const Vector<float> &v2) {
+       return Vector<float>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<>
+inline Vector<double> operator %(const Vector<double> &v1, const Vector<double> &v2) {
+       return Vector<double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<>
+inline Vector<long double> operator %(const Vector<long double> &v1, const Vector<long double> &v2) {
+       return Vector<long double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<class T>
+inline Vector<T> operator %(const Vector<T> &v, T s) {
+       return Vector<T>(v.X() % s, v.Y() % s);
+}
+template<>
+inline Vector<float> operator %(const Vector<float> &v, float s) {
+       return Vector<float>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+template<>
+inline Vector<double> operator %(const Vector<double> &v, double s) {
+       return Vector<double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+template<>
+inline Vector<long double> operator %(const Vector<long double> &v, long double s) {
+       return Vector<long double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+
+template<class T>
+inline bool operator ==(const Vector<T> &lhs, const Vector<T> &rhs) {
+       return lhs.X() == rhs.X() && lhs.Y() == rhs.Y();
+}
+
+template<class T>
+inline bool operator !=(const Vector<T> &lhs, const Vector<T> &rhs) {
+       return lhs.X() != rhs.X() || lhs.Y() != rhs.Y();
+}
+
+template<class T>
+inline std::ostream &operator <<(std::ostream &out, const Vector<T> &v) {
+       out << '<' << v.X() << ", " << v.Y() << '>';
+       return out;
+}
+
+
+template <class Scalar>
+void Vector<Scalar>::Lock(const Vector<Scalar> &to) {
+       Vector<Scalar> half(to / Scalar(2));
+       Vector<Scalar> dist((*this) % to);
+
+       if (dist.X() > half.X()) {
+               x += (to.X() - dist.X());
+       } else {
+               x -= dist.X();
+       }
+
+       if (dist.Y() > half.Y()) {
+               y += (to.Y() - dist.Y());
+       } else {
+               y -= dist.Y();
+       }
+}
+
+
+}
+
+#endif /* GEOMETRY_VECTOR_H_ */
diff --git a/src/math/fwd.h b/src/math/fwd.h
new file mode 100644 (file)
index 0000000..9e143fd
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef MATH_FWD_H_
+#define MATH_FWD_H_
+
+namespace math {
+
+template<class Scalar>
+class Vector;
+
+}
+
+#endif /* MATH_FWD_H_ */
index 386d22cf79c891834633dfd4f5d4c2a7a8b3b06b..de9492988875c6181d69a2ae0a6abd5ae62cf702 100644 (file)
@@ -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;
 
index a48a6b2f0ffaa1a1367744c00d59f06445ab540d..354cb61d09e7012df633297612f0a425482cc86b 100644 (file)
@@ -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<int> &) const;
+       void RenderClasses(SDL_Surface *, const math::Vector<int> &) const;
 
 public:
        int Width() const;
index e0789285e1be92b67a1fe647028e527ef265e28c..43324c71d6a3e9c8eb0d6debb5816b5555d74534 100644 (file)
@@ -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;
 
index 1999674b6b453bbb1e8a2f4102865d4e517aa64e..3ea8c1a097861c5710e65e6b2934970aa0d734a6 100644 (file)
@@ -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<int> &offset) const;
-       void RenderSprite(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderGrowth(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderHunger(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderItems(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderName(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderSprite(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderGrowth(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderHunger(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderItems(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        CapsuleMenu *parent;
index 564b3bf5df928503418b20957b97d3d9020d7207..67afd57af42ee4360b44a197af487bd59c6bba67 100644 (file)
@@ -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<int> &offset) co
        font.DrawNumberRight(capsule.NextLevel(), screen, lineHead);
 }
 
-void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const {
+void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const math::Vector<int> &offset, const char *name, int value) const {
        const Font &font(*Res().statusFont);
        const Vector<int> numberOffset(4 * font.CharWidth(), 0);
 
index 6358a6a269a2d986a09dae61a6a60c6bfdf895ce..8f8063785a485369c6d9c22896644b1313e8c91e 100644 (file)
@@ -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<int> &offset) const;
-       void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderWheel(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStats(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderCapsule(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderInfo(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderWheel(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStats(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStatsLine(SDL_Surface *screen, const math::Vector<int> &offset, const char *name, int value) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 public:
        common::GameConfig &Game();
index 58db75e89b9fddd81173e5c8f0df30907b0c25c8..2bdad28bf7c0f7b85a13708b8012da8c4107822d 100644 (file)
@@ -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;
 
index 77211e2152c8dcc7d53f882d33c31d6aaf25f525..f85d11ce554b03a9373eae103c09ca24bf660e75 100644 (file)
@@ -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<int> &offset) const;
-       void RenderAlphabet(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderName(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderAlphabet(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        CapsuleMenu *parent;
index 7cd9b08a3d1c3e22636fe8f0ef2833fcb2ead365..0c1ed4a10ebc70fbf4adf3b41f3b5502d4a4e52c 100644 (file)
@@ -12,7 +12,7 @@
 #include <algorithm>
 
 using app::Input;
-using geometry::Vector;
+using math::Vector;
 using std::swap;
 
 namespace menu {
index 4b80694ffd670ac5b2c14c1f06454dc86c24b594..ca5f64bac141189f266c5ae9a9fb75c135002c1e 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "fwd.h"
 #include "../app/State.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -34,7 +34,7 @@ private:
 
        void SelectedHero(int index);
 
-       void RenderHighlight(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHighlight(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
        static void OnHeroSelected(void *, int);
 
index 6d6e2d12543e51a8e47f644aa064d85b7da02df7..e96c76bad7351226cc75e5bddaa96354f42095e6 100644 (file)
@@ -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<int> &offset) const {
+void ConfigMenu::RenderHeadline(SDL_Surface *screen, const math::Vector<int> &offset) const {
        const Font &font(*parent->Res().normalFont);
        const Frame &frame(*parent->Res().statusFrame);
        const Vector<int> textOffset(
@@ -125,7 +125,7 @@ void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector<int>
        font.DrawString(parent->Res().mainMenuConfigText, screen, offset + textOffset, 6);
 }
 
-void ConfigMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void ConfigMenu::RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const {
        const Resources &res(parent->Res());
        const Font &font(*res.normalFont);
        const Font &inactiveFont(*res.inactiveFont);
index f7dda534966a2672da11e04aaddee6f8bab60c7a..f5e31c12499eb0b29234f32fbf52e02e3c25f821 100644 (file)
@@ -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<int> &offset) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHeadline(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index 86e8cdbc8b5f5321a369818b7306ec1658a834e0..494c25a5af89afacbd9bc088eee6d17e96a74bb3 100644 (file)
@@ -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;
 
index 5c2cc9b583307a49bf4854093f8a05af542b92ea..ffa7a837b476ab9a61a8988ec02337a3da313066 100644 (file)
@@ -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<int> &offset) const;
-       void RenderStats(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const geometry::Vector<int> &position) const;
-       void RenderEquipmentMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderActionMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderInventoryMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderStatus(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStats(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const math::Vector<int> &position) const;
+       void RenderEquipmentMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderActionMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderInventoryMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index 30091cb14ef56d09a3ebe5e36f1c6abeba03dcf5..919fd8553065dae2ca56524a3824c2561d60418f 100644 (file)
@@ -5,7 +5,7 @@
 #include "../graphics/Font.h"
 #include "../graphics/Sprite.h"
 
-using geometry::Vector;
+using math::Vector;
 
 namespace menu {
 
index 03c7811adecf79ec7368aa8bb45e1c462f5eb5c9..e24cb6c0db3e6b9e2633f4ec18ed500f7830b3ef 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "fwd.h"
 #include "../common/fwd.h"
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 
 #include <SDL.h>
 
@@ -21,9 +21,9 @@ public:
 
        int Width() const;
        int Height() const;
-       geometry::Vector<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
+       math::Vector<int> Size() const { return math::Vector<int>(Width(), Height()); }
 
-       void Render(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void Render(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        const Resources *res;
index c980f9719a3c120e0097f5a8c19bcb63cbdced90..95ca7464ca1348615ceebdf00adba0320e89aa52 100644 (file)
@@ -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;
index e0cb6feee1ca9463528518689688a6e6cd11bdcc..11acf46ce249d35f2fa3d90747b85fb4c2894ff7 100644 (file)
@@ -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<int> &offset) const;
-       void RenderInventory(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderInventory(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index f3176b3f70981aa4fe66c942b3d4ea4bd9d6aa8c..577772ea88eba74054987f269d3d7361500bd855 100644 (file)
 #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 {
 
index 08ffa3823b46c1a8a6b07db38f6982fd75fdb398..a009c339c4a0acc25c4f5f491b2320eecc955c4a 100644 (file)
@@ -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<int> &offset) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHeros(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderInfo(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
-       geometry::Vector<int> StatusOffset(int index) const;
+       math::Vector<int> 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<int> statusPositions[4];
+       math::Vector<int> statusPositions[4];
        common::GameConfig *game;
        graphics::Menu<int> mainMenu;
 
index 2c317bb29c158eaf77daeec8a61607830ba8eb84..a86f9a93412654bcba39ad8d41ed72f291bf974a 100644 (file)
@@ -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<int> &offset) const {
+void ScenarioMenu::RenderHeadline(SDL_Surface *screen, const math::Vector<int> &offset) const {
        const Font &font(*parent->Res().normalFont);
        const Frame &frame(*parent->Res().statusFrame);
        const Vector<int> textOffset(2 * font.CharWidth(), font.CharHeight());
@@ -110,7 +110,7 @@ void ScenarioMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector<in
        font.DrawString(parent->Res().scenarioMenuHeadline, screen, offset + textOffset);
 }
 
-void ScenarioMenu::RenderItems(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void ScenarioMenu::RenderItems(SDL_Surface *screen, const math::Vector<int> &offset) const {
        const Font &font(*parent->Res().normalFont);
        const Frame &frame(*parent->Res().statusFrame);
        const Vector<int> menuOffset(3 * font.CharWidth(), font.CharHeight() + font.CharHeight() / 4);
index 23cb5145bf2d3fa42a8b7e5d9da4678fcc1a77a6..3e99ef000097aa4dd25580fb44908e5d98a3f328 100644 (file)
@@ -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<int> &offset) const;
-       void RenderItems(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHeadline(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderItems(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index a46333a6e9dc70c123f6f787d57a1503b06b51d0..e573d323c144562a2f78bd79f5559119cbf7c0e7 100644 (file)
@@ -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 {
 
index bb66d3c6fcbddff09d6ae5187a0c2b72e3b540fa..af743ccdc9ffcfabfbc680789ebce3175cdf27fd 100644 (file)
@@ -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;
index 6cef923689c60e5024771832631c46b8741e8567..42dbfbbbabaf04022748d6de00d8cd89e111f136 100644 (file)
@@ -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<int> &offset) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderSpells(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHighlight(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderSpells(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index 55ba56eb92487787daf98b08ec12c80eec7930f7..09c94050bc321ac4a49393c9fb99bf4751cd7e97 100644 (file)
@@ -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<int> &offset) const {
+void StatusMenu::RenderExperience(SDL_Surface *screen, const math::Vector<int> &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<in
        font.DrawNumberRight(GetHero().Experience(), screen, numberOffset, 7);
 }
 
-void StatusMenu::RenderNextLevel(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void StatusMenu::RenderNextLevel(SDL_Surface *screen, const math::Vector<int> &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<int
        font.DrawNumberRight(GetHero().NextLevel(), screen, numberOffset, 7);
 }
 
-void StatusMenu::RenderIkari(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void StatusMenu::RenderIkari(SDL_Surface *screen, const math::Vector<int> &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<int> &o
        font.DrawChar('%', screen, percentOffset);
 }
 
-void StatusMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void StatusMenu::RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const {
        const Font &font(*parent->Res().normalFont);
        const Frame &frame(*parent->Res().statusFrame);
 
index 08d2e0b1dbc958ee874031fef5c6857eff9b6d85..eaf10177a7c396317e3b695617ed78aa19f2ae65 100644 (file)
@@ -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<int> &offset) const;
-       void RenderStats(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const geometry::Vector<int> &position) const;
-       void RenderEquipment(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderEquipmentLine(const common::Item *, SDL_Surface *screen, const geometry::Vector<int> &position) const;
+       void RenderStatus(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStats(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderStatsLine(const char *label, int number, SDL_Surface *screen, const math::Vector<int> &position) const;
+       void RenderEquipment(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderEquipmentLine(const common::Item *, SDL_Surface *screen, const math::Vector<int> &position) const;
        /// @param offset the top right corner!
-       void RenderExperience(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderExperience(SDL_Surface *screen, const math::Vector<int> &offset) const;
        /// @param offset the top right corner!
-       void RenderNextLevel(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderIkari(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderNextLevel(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderIkari(SDL_Surface *screen, const math::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const math::Vector<int> &offset) const;
 
 private:
        PartyMenu *parent;
index 94eb6252465e8238953c76966c08662edc19b116..1dbf502cd953ed1698ac738ebfb3ca616e2ff9c3 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <cmath>
 
-using geometry::Vector;
+using math::Vector;
 
 namespace sdl {
 
@@ -15,7 +15,7 @@ void HorizontalLine(SDL_Surface *dst, const Vector<int> &position, unsigned int
        SDL_FillRect(dst, &destRect, color);
 }
 
-void VerticalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color) {
+void VerticalLine(SDL_Surface *dst, const math::Vector<int> &position, unsigned int length, Uint32 color) {
        SDL_Rect destRect;
        destRect.x = position.X();
        destRect.y = position.Y();
index 40867dde58663d3d58ff6d5d466847888b5af94a..295877ff9cc314be4df10ff6df8313acdc153d43 100644 (file)
@@ -1,15 +1,15 @@
 #ifndef SDL_UTILITY_H_
 #define SDL_UTILITY_H_
 
-#include "../geometry/Vector.h"
+#include "../math/Vector.h"
 #include <SDL.h>
 
 namespace sdl {
 
-void HorizontalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color);
-void VerticalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color);
+void HorizontalLine(SDL_Surface *dst, const math::Vector<int> &position, unsigned int length, Uint32 color);
+void VerticalLine(SDL_Surface *dst, const math::Vector<int> &position, unsigned int length, Uint32 color);
 
-void OutlineRect(SDL_Surface *dst, const geometry::Vector<int> &from, const geometry::Vector<int> &to, Uint32 color);
+void OutlineRect(SDL_Surface *dst, const math::Vector<int> &from, const math::Vector<int> &to, Uint32 color);
 void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
 
 }
diff --git a/tests/geometry/VectorTest.cpp b/tests/geometry/VectorTest.cpp
deleted file mode 100644 (file)
index 7ba58d2..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#include "VectorTest.h"
-
-#include <limits>
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_geometry::VectorTest);
-
-using geometry::Vector;
-
-
-namespace test_geometry {
-
-void VectorTest::setUp() {
-
-}
-
-void VectorTest::tearDown() {
-
-}
-
-
-void VectorTest::testComparison() {
-       CPPUNIT_ASSERT_EQUAL(Vector<int>(0, 0), Vector<int>(0, 0));
-
-       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(0, 1));
-       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(1, 0));
-       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(1, 1));
-}
-
-void VectorTest::testSum() {
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(1, 1),
-                       Vector<int>(1, 1) + Vector<int>(0, 0));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(1, 1),
-                       Vector<int>(0, 1) + Vector<int>(1, 0));
-
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(1, 1),
-                       Vector<int>(1, 1) - Vector<int>(0, 0));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(0, 1),
-                       Vector<int>(1, 1) - Vector<int>(1, 0));
-}
-
-void VectorTest::testProduct() {
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(2, 3),
-                       Vector<int>(2, 3) * Vector<int>(1, 1));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(10, 12),
-                       Vector<int>(2, 3) * Vector<int>(5, 4));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(2, 3),
-                       Vector<int>(2, 3) * 1);
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(4, 6),
-                       Vector<int>(2, 3) * 2);
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(2, 3),
-                       1 * Vector<int>(2, 3));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(4, 6),
-                       2 * Vector<int>(2, 3));
-
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(10, 12),
-                       Vector<int>(10, 12) / Vector<int>(1, 1));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(2, 3),
-                       Vector<int>(10, 12) / Vector<int>(5, 4));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(4, 6),
-                       Vector<int>(4, 6) / 1);
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(2, 3),
-                       Vector<int>(4, 6) / 2);
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(3, 4),
-                       12 / Vector<int>(4, 3));
-}
-
-void VectorTest::testModulo() {
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(0, 0),
-                       Vector<int>(1, 2) % Vector<int>(1, 1));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(0, 0),
-                       Vector<int>(1, 2) % 1);
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(3, 1),
-                       Vector<int>(3, 5) % Vector<int>(4, 2));
-       CPPUNIT_ASSERT_EQUAL(
-                       Vector<int>(3, 1),
-                       Vector<int>(3, 5) % 4);
-
-       Vector<float> vecf = Vector<float>(4.0f, 5.0f) % Vector<float>(2.0f, 3.0f);
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, vecf.X(), std::numeric_limits<float>::epsilon());
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0f, vecf.Y(), std::numeric_limits<float>::epsilon());
-
-       vecf = Vector<float>(4.0f, 5.0f) % 4.0f;
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, vecf.X(), std::numeric_limits<float>::epsilon());
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0f, vecf.Y(), std::numeric_limits<float>::epsilon());
-
-       Vector<double> vecd = Vector<double>(4.0, 5.0) % Vector<double>(2.0, 3.0);
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, vecd.X(), std::numeric_limits<double>::epsilon());
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, vecd.Y(), std::numeric_limits<double>::epsilon());
-
-       vecd = Vector<double>(4.0, 5.0) % 4.0;
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, vecd.X(), std::numeric_limits<double>::epsilon());
-       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vecd.Y(), std::numeric_limits<double>::epsilon());
-}
-
-void VectorTest::testFunctional() {
-       const Vector<int> vec(2, 5);
-       CPPUNIT_ASSERT_EQUAL(2, vec.X());
-       CPPUNIT_ASSERT_EQUAL(5, vec.Y());
-       CPPUNIT_ASSERT_EQUAL(52, vec.Index(10));
-
-       const Vector<int> indexVec = Vector<int>::FromIndex(52, 10);
-       CPPUNIT_ASSERT_EQUAL(vec, indexVec);
-
-       Vector<int> lockedVec = Vector<int>(vec);
-       lockedVec.Lock(Vector<int>(2, 2));
-       CPPUNIT_ASSERT_EQUAL(Vector<int>(2, 4), lockedVec);
-}
-
-}
diff --git a/tests/geometry/VectorTest.h b/tests/geometry/VectorTest.h
deleted file mode 100644 (file)
index e6e2b29..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef TEST_GEOMETRY_VECTORTEST_H_
-#define TEST_GEOMETRY_VECTORTEST_H_
-
-#include "../../src/geometry/Vector.h"
-
-#include <cppunit/extensions/HelperMacros.h>
-
-
-namespace test_geometry {
-
-class VectorTest
-: public CppUnit::TestFixture {
-
-CPPUNIT_TEST_SUITE(VectorTest);
-CPPUNIT_TEST(testComparison);
-CPPUNIT_TEST(testSum);
-CPPUNIT_TEST(testProduct);
-CPPUNIT_TEST(testModulo);
-CPPUNIT_TEST(testFunctional);
-CPPUNIT_TEST_SUITE_END();
-
-public:
-       void setUp();
-       void tearDown();
-
-       void testComparison();
-       void testSum();
-       void testProduct();
-       void testModulo();
-       void testFunctional();
-
-};
-
-}
-
-#endif
diff --git a/tests/math/VectorTest.cpp b/tests/math/VectorTest.cpp
new file mode 100644 (file)
index 0000000..2f10504
--- /dev/null
@@ -0,0 +1,127 @@
+#include "VectorTest.h"
+
+#include <limits>
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_math::VectorTest);
+
+using math::Vector;
+
+
+namespace test_math {
+
+void VectorTest::setUp() {
+
+}
+
+void VectorTest::tearDown() {
+
+}
+
+
+void VectorTest::testComparison() {
+       CPPUNIT_ASSERT_EQUAL(Vector<int>(0, 0), Vector<int>(0, 0));
+
+       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(0, 1));
+       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(1, 0));
+       CPPUNIT_ASSERT(Vector<int>(0, 0) != Vector<int>(1, 1));
+}
+
+void VectorTest::testSum() {
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(1, 1),
+                       Vector<int>(1, 1) + Vector<int>(0, 0));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(1, 1),
+                       Vector<int>(0, 1) + Vector<int>(1, 0));
+
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(1, 1),
+                       Vector<int>(1, 1) - Vector<int>(0, 0));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(0, 1),
+                       Vector<int>(1, 1) - Vector<int>(1, 0));
+}
+
+void VectorTest::testProduct() {
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(2, 3),
+                       Vector<int>(2, 3) * Vector<int>(1, 1));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(10, 12),
+                       Vector<int>(2, 3) * Vector<int>(5, 4));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(2, 3),
+                       Vector<int>(2, 3) * 1);
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(4, 6),
+                       Vector<int>(2, 3) * 2);
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(2, 3),
+                       1 * Vector<int>(2, 3));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(4, 6),
+                       2 * Vector<int>(2, 3));
+
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(10, 12),
+                       Vector<int>(10, 12) / Vector<int>(1, 1));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(2, 3),
+                       Vector<int>(10, 12) / Vector<int>(5, 4));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(4, 6),
+                       Vector<int>(4, 6) / 1);
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(2, 3),
+                       Vector<int>(4, 6) / 2);
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(3, 4),
+                       12 / Vector<int>(4, 3));
+}
+
+void VectorTest::testModulo() {
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(0, 0),
+                       Vector<int>(1, 2) % Vector<int>(1, 1));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(0, 0),
+                       Vector<int>(1, 2) % 1);
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(3, 1),
+                       Vector<int>(3, 5) % Vector<int>(4, 2));
+       CPPUNIT_ASSERT_EQUAL(
+                       Vector<int>(3, 1),
+                       Vector<int>(3, 5) % 4);
+
+       Vector<float> vecf = Vector<float>(4.0f, 5.0f) % Vector<float>(2.0f, 3.0f);
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, vecf.X(), std::numeric_limits<float>::epsilon());
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0f, vecf.Y(), std::numeric_limits<float>::epsilon());
+
+       vecf = Vector<float>(4.0f, 5.0f) % 4.0f;
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, vecf.X(), std::numeric_limits<float>::epsilon());
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0f, vecf.Y(), std::numeric_limits<float>::epsilon());
+
+       Vector<double> vecd = Vector<double>(4.0, 5.0) % Vector<double>(2.0, 3.0);
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, vecd.X(), std::numeric_limits<double>::epsilon());
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, vecd.Y(), std::numeric_limits<double>::epsilon());
+
+       vecd = Vector<double>(4.0, 5.0) % 4.0;
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, vecd.X(), std::numeric_limits<double>::epsilon());
+       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vecd.Y(), std::numeric_limits<double>::epsilon());
+}
+
+void VectorTest::testFunctional() {
+       const Vector<int> vec(2, 5);
+       CPPUNIT_ASSERT_EQUAL(2, vec.X());
+       CPPUNIT_ASSERT_EQUAL(5, vec.Y());
+       CPPUNIT_ASSERT_EQUAL(52, vec.Index(10));
+
+       const Vector<int> indexVec = Vector<int>::FromIndex(52, 10);
+       CPPUNIT_ASSERT_EQUAL(vec, indexVec);
+
+       Vector<int> lockedVec = Vector<int>(vec);
+       lockedVec.Lock(Vector<int>(2, 2));
+       CPPUNIT_ASSERT_EQUAL(Vector<int>(2, 4), lockedVec);
+}
+
+}
diff --git a/tests/math/VectorTest.h b/tests/math/VectorTest.h
new file mode 100644 (file)
index 0000000..fdd2c3a
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef TEST_MATH_VECTORTEST_H_
+#define TEST_MATH_VECTORTEST_H_
+
+#include "../../src/math/Vector.h"
+
+#include <cppunit/extensions/HelperMacros.h>
+
+
+namespace test_math {
+
+class VectorTest
+: public CppUnit::TestFixture {
+
+CPPUNIT_TEST_SUITE(VectorTest);
+CPPUNIT_TEST(testComparison);
+CPPUNIT_TEST(testSum);
+CPPUNIT_TEST(testProduct);
+CPPUNIT_TEST(testModulo);
+CPPUNIT_TEST(testFunctional);
+CPPUNIT_TEST_SUITE_END();
+
+public:
+       void setUp();
+       void tearDown();
+
+       void testComparison();
+       void testSum();
+       void testProduct();
+       void testModulo();
+       void testFunctional();
+
+};
+
+}
+
+#endif