]> git.localhorst.tv Git - l2e.git/commitdiff
merged Point into Vector
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 22 Aug 2012 20:35:37 +0000 (22:35 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 22 Aug 2012 20:54:30 +0000 (22:54 +0200)
this should make some stuff a lot easier

40 files changed:
src/battle/AttackTypeMenu.cpp
src/battle/AttackTypeMenu.h
src/battle/BattleState.cpp
src/battle/BattleState.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/SelectAttackType.cpp
src/battle/states/SelectIkari.cpp
src/battle/states/SelectItem.cpp
src/battle/states/SelectMoveAction.cpp
src/battle/states/SelectSpell.cpp
src/battle/states/SelectTarget.cpp
src/battle/states/SwapHeroes.cpp
src/geometry/Point.h [deleted file]
src/geometry/Vector.h
src/geometry/operators.h [deleted file]
src/graphics/Animation.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/main.cpp

index 2ec7a1f129b26bbe25eadf47232d014023fc8cdd..b18c5221021aca9c32b8618a74b1e0abba78e308 100644 (file)
@@ -7,16 +7,14 @@
 
 #include "AttackTypeMenu.h"
 
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Sprite.h"
 
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
 
-void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Point<int> &position) {
+void AttackTypeMenu::Render(SDL_Surface *screen, const geometry::Vector<int> &position) {
        Vector<int> swordOffset(IconWidth(), IconHeight());
        Vector<int> magicOffset(IconWidth(), 0);
        Vector<int> defendOffset(2 * IconWidth(), IconHeight());
index 4b38dd3bd45d2ecf908fb0242df93d94e5a13123..d31d63babf03593b07dac87eaa93473d94f2ab81 100644 (file)
@@ -9,7 +9,7 @@
 #define BATTLE_ATTACKTYPEMENU_H_
 
 #include "AttackChoice.h"
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 #include "../graphics/Sprite.h"
 
 #include <SDL.h>
@@ -25,7 +25,7 @@ public:
 public:
        void Select(AttackChoice::Type t) { selected = t; }
        AttackChoice::Type Selected() const { return selected; }
-       void Render(SDL_Surface *screen, const geometry::Point<int> &position);
+       void Render(SDL_Surface *screen, const geometry::Vector<int> &position);
 
        int Width() const { return 3 * IconWidth(); }
        int Height() const { return 3 * IconHeight(); }
index ae88731fe0c9d06cde1edc265e6e868cb640dc2f..f548f2dfdc6968a59c4ce8a8dbd09ec50f24d1e0 100644 (file)
@@ -16,7 +16,6 @@
 #include "../common/Inventory.h"
 #include "../common/Item.h"
 #include "../common/Spell.h"
-#include "../geometry/operators.h"
 #include "../graphics/Frame.h"
 #include "../graphics/Sprite.h"
 
@@ -30,7 +29,6 @@ using app::Input;
 using common::Inventory;
 using common::Item;
 using common::Spell;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Menu;
 
@@ -97,19 +95,19 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
        int tagHeight(attackTypeMenu.Height());
        int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
        int xOffset((Width() - 2 * tagWidth) / 2);
-       heroTagPositions[0] = Point<int>(xOffset, Height() - 2 * tagHeight);
-       heroTagPositions[1] = Point<int>(xOffset + tagWidth, Height() - 2 * tagHeight);
-       heroTagPositions[2] = Point<int>(xOffset, Height() - tagHeight);
-       heroTagPositions[3] = Point<int>(xOffset + tagWidth, Height() - tagHeight);
+       heroTagPositions[0] = Vector<int>(xOffset, Height() - 2 * tagHeight);
+       heroTagPositions[1] = Vector<int>(xOffset + tagWidth, Height() - 2 * tagHeight);
+       heroTagPositions[2] = Vector<int>(xOffset, Height() - tagHeight);
+       heroTagPositions[3] = Vector<int>(xOffset + tagWidth, Height() - tagHeight);
 
        tagHeight = res->normalFont->CharHeight() * 4 + res->smallHeroTagFrame->BorderHeight() * 2;
        tagWidth = res->normalFont->CharWidth() * 6 + res->smallHeroTagFrame->BorderWidth() * 2;
        xOffset = (Width() - 4 * tagWidth) / 2;
        int yOffset(Height() - tagHeight);
-       smallHeroTagPositions[0] = Point<int>(xOffset, yOffset);
-       smallHeroTagPositions[1] = Point<int>(xOffset + 2 * tagWidth, yOffset);
-       smallHeroTagPositions[2] = Point<int>(xOffset + tagWidth, yOffset);
-       smallHeroTagPositions[3] = Point<int>(xOffset + 3 * tagWidth, yOffset);
+       smallHeroTagPositions[0] = Vector<int>(xOffset, yOffset);
+       smallHeroTagPositions[1] = Vector<int>(xOffset + 2 * tagWidth, yOffset);
+       smallHeroTagPositions[2] = Vector<int>(xOffset + tagWidth, yOffset);
+       smallHeroTagPositions[3] = Vector<int>(xOffset + 3 * tagWidth, yOffset);
 
        itemMenu = res->itemMenuPrototype;
        LoadInventory();
index a6ba39829d9f6de2718aace409980542d71b6ce5..27953cd013cd5e050aa9d2bded9a20eeb78856f8 100644 (file)
@@ -16,7 +16,6 @@
 #include "Resources.h"
 #include "SmallHeroTag.h"
 #include "../app/State.h"
-#include "../geometry/Point.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Animation.h"
 #include "../graphics/Menu.h"
@@ -99,7 +98,7 @@ public:
        const Monster &MonsterAt(int index) const { assert(index >= 0 && index < NumHeroes()); return monsters[index]; }
 
        const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; }
-       const geometry::Point<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
+       const geometry::Vector<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
 
        bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; }
        bool AttackSelectionDone() const { return activeHero >= numHeroes; }
@@ -167,8 +166,8 @@ private:
        graphics::Menu<const common::Item *> itemMenu;
        HeroTag heroTags[4];
        SmallHeroTag smallHeroTags[4];
-       geometry::Point<int> heroTagPositions[4];
-       geometry::Point<int> smallHeroTagPositions[4];
+       geometry::Vector<int> heroTagPositions[4];
+       geometry::Vector<int> smallHeroTagPositions[4];
        int numHeroes;
        int activeHero;
        int attackCursor;
index 74449026f93efe706ac469222d895e6194808517..1cce110df994e3af3fef811581bbc4016df6803b 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "AttackChoice.h"
 #include "Stats.h"
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 #include "../graphics/Animation.h"
 #include "../graphics/Menu.h"
 
@@ -88,8 +88,8 @@ public:
        const graphics::Animation *AttackAnimation() const { return attackAnimation; }
        const graphics::Animation *SpellAnimation() const { return spellAnimation; }
 
-       geometry::Point<int> &Position() { return position; }
-       const geometry::Point<int> &Position() const { return position; }
+       geometry::Vector<int> &Position() { return position; }
+       const geometry::Vector<int> &Position() const { return position; }
 
        graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
        const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
@@ -147,7 +147,7 @@ private:
 
        graphics::AnimationRunner animation;
 
-       geometry::Point<int> position;
+       geometry::Vector<int> position;
 
        graphics::Menu<const common::Spell *> spellMenu;
        graphics::Menu<const common::Item *> ikariMenu;
index 228bfda4aef5e654a368c8c1634460f4ca890541..7938250910aa284a2f2f9946c9f685be5914088c 100644 (file)
 #include "BattleState.h"
 #include "Hero.h"
 #include "Resources.h"
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
 #include "../graphics/Gauge.h"
 #include "../graphics/Sprite.h"
 
-using geometry::Point;
 using geometry::Vector;
 using graphics::Frame;
 
@@ -28,7 +26,7 @@ const graphics::Sprite *HeroTag::HeroSprite() const {
        return battle->HeroAt(index).Sprite();
 }
 
-void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> position, bool active) const {
+void HeroTag::Render(SDL_Surface *screen, int width, int height, Vector<int> position, bool active) const {
        const Resources &r(battle->Res());
 
        // frame
index f1408fd1882b6c5b0dfb413ba37a24702e617f7f..43dc66112a4da947404105d9a65fd6bd7a649452 100644 (file)
@@ -9,7 +9,6 @@
 #define BATTLE_HEROTAG_H_
 
 #include "Hero.h"
-#include "../geometry/Point.h"
 #include "../geometry/Vector.h"
 
 #include <SDL.h>
@@ -36,7 +35,7 @@ public:
        const graphics::Sprite *HeroSprite() const;
        geometry::Vector<int> HeroOffset() const;
 
-       void Render(SDL_Surface *screen, int width, int height, geometry::Point<int> position, bool active) const;
+       void Render(SDL_Surface *screen, int width, int height, geometry::Vector<int> position, bool active) const;
 
 private:
        const BattleState *battle;
index 8338cb18e59f8e6836c0fb6c617e280ff9f74a2f..c12567257e01a33e69d45acbb0f451c18db4609e 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "AttackChoice.h"
 #include "Stats.h"
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 #include "../graphics/Animation.h"
 
 #include <SDL.h>
@@ -62,8 +62,8 @@ public:
        const graphics::Animation *AttackAnimation() const { return attackAnimation; }
        const graphics::Animation *SpellAnimation() const { return spellAnimation; }
 
-       geometry::Point<int> &Position() { return position; }
-       const geometry::Point<int> &Position() const { return position; }
+       geometry::Vector<int> &Position() { return position; }
+       const geometry::Vector<int> &Position() const { return position; }
 
 // temporary setters until loader is implemented
 public:
@@ -97,7 +97,7 @@ private:
 
        graphics::AnimationRunner animation;
 
-       geometry::Point<int> position;
+       geometry::Vector<int> position;
 
        AttackChoice attackChoice;
 
index 4d5ff792be7d047f0ca42b75a54ed5528a5274a7..849f694a042e21f78d67e29bcfd36fe7b37305b5 100644 (file)
@@ -7,16 +7,14 @@
 
 #include "MoveMenu.h"
 
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Sprite.h"
 
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
 
-void MoveMenu::Render(SDL_Surface *screen, const geometry::Point<int> &position) {
+void MoveMenu::Render(SDL_Surface *screen, const geometry::Vector<int> &position) {
        Vector<int> attackOffset(0, IconHeight());
        Vector<int> changeOffset(0, 0);
        Vector<int> runOffset(0, 2 * IconHeight());
index 771fcb8692f1ed287779644105e5b7dba86528ae..63b9d884326f216b5236bff5ef8d10ef76d842e0 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BATTLE_MOVEMENU_H_
 #define BATTLE_MOVEMENU_H_
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 #include "../graphics/Sprite.h"
 
 namespace battle {
@@ -30,7 +30,7 @@ public:
 public:
        void Select(Icon i) { selected = i; }
        Icon Selected() const { return selected; }
-       void Render(SDL_Surface *screen, const geometry::Point<int> &position);
+       void Render(SDL_Surface *screen, const geometry::Vector<int> &position);
 
        int Width() const { return IconWidth(); }
        int Height() const { return 3 * IconHeight(); }
index 17eb771c64b91b7607b76b1c6e8d91f9983a38fb..fcc707f7802e25f28c4bc2a4751d6abbd741e332 100644 (file)
@@ -7,11 +7,9 @@
 
 #include "NumberAnimation.h"
 
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 
 using app::State;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Animation;
 using graphics::AnimationRunner;
@@ -87,8 +85,8 @@ int NumberAnimation::Height() const {
        return animation[0].GetSprite()->Height();
 }
 
-void NumberAnimation::Draw(SDL_Surface *dest, const Point<int> &positionIn) const {
-       Point<int> position(positionIn);
+void NumberAnimation::Draw(SDL_Surface *dest, const Vector<int> &positionIn) const {
+       Vector<int> position(positionIn);
        Vector<int> step(animation[0].GetSprite()->Width(), 0);
        if (number > 999) {
                if (animation[0].Running()) {
index 08ca01ff2886f322916592c4f261f7938de5970b..f7530562f048233788f7572ba6ae1c92bbebf51a 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "../graphics/Animation.h"
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 namespace app {
        class Application;
@@ -33,7 +33,7 @@ public:
        int Width() const;
        int Height() const;
 
-       void Draw(SDL_Surface *dest, const geometry::Point<int> &position) const;
+       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position) const;
 
 private:
        int number;
index e1fd33ffd0953c12083c63d1882a48fbae0cf873..6389327528bd77df1e4c233147b2d5ad51609d93 100644 (file)
@@ -7,9 +7,6 @@
 
 #include "PartyLayout.h"
 
-using geometry::Point;
-using std::vector;
-
 namespace battle {
 
 }
index 684413964d096b77b352f5e31840d97acc47c65e..1d72aa8ad483bc8fadeafc6cf62a16d41fea5971 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BATTLE_PARTYLAYOUT_H_
 #define BATTLE_PARTYLAYOUT_H_
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 #include <cassert>
 #include <vector>
@@ -22,34 +22,34 @@ public:
        PartyLayout() { }
 
 public:
-       std::vector<geometry::Point<Uint8> >::size_type NumPositions() const { return positions.size(); }
+       std::vector<geometry::Vector<Uint8> >::size_type NumPositions() const { return positions.size(); }
        template<class U>
-       void CalculatePositions(U width, U height, std::vector<geometry::Point<U> > &dest) const {
+       void CalculatePositions(U width, U height, std::vector<geometry::Vector<U> > &dest) const {
                dest.clear();
                dest.reserve(positions.size());
-               for (std::vector<geometry::Point<Uint8> >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) {
-                       dest.push_back(geometry::Point<U>(
+               for (std::vector<geometry::Vector<Uint8> >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) {
+                       dest.push_back(geometry::Vector<U>(
                                        i->X() * width / 255,
                                        i->Y() * height / 223
                                        ));
                }
        }
        template<class U>
-       geometry::Point<U> CalculatePosition(std::vector<geometry::Point<Uint8> >::size_type index, U width, U height) const {
+       geometry::Vector<U> CalculatePosition(std::vector<geometry::Vector<Uint8> >::size_type index, U width, U height) const {
                assert(index >= 0 && index < positions.size());
-               return geometry::Point<U>(
+               return geometry::Vector<U>(
                                positions[index].X() * width / 255,
                                positions[index].Y() * height / 223
                                );
        }
 
 public:
-       void AddPosition(const geometry::Point<Uint8> &p) {
+       void AddPosition(const geometry::Vector<Uint8> &p) {
                positions.push_back(p);
        }
 
 private:
-       std::vector<geometry::Point<Uint8> > positions;
+       std::vector<geometry::Vector<Uint8> > positions;
 
 };
 
index 7843cc0cba29c62e4884ae814ce3a8886718b20e..0bc160a33b4078f35465db81700408cf94a08a96 100644 (file)
@@ -8,13 +8,11 @@
 #include "SmallHeroTag.h"
 
 #include "BattleState.h"
-#include "../geometry/operators.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
 #include "../graphics/Gauge.h"
 
-using geometry::Point;
 using geometry::Vector;
 using graphics::Font;
 using graphics::Frame;
@@ -22,7 +20,7 @@ using graphics::Sprite;
 
 namespace battle {
 
-void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, geometry::Point<int> position) const {
+void SmallHeroTag::Render(SDL_Surface *screen, int width, int height, geometry::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 1f392c31ebc81f77745c0686d6c142bfd7277d17..acd2d3158a13f83d80c995dfa08d0a57e769e5aa 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BATTLE_SMALLHEROTAG_H_
 #define BATTLE_SMALLHEROTAG_H_
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 #include <SDL.h>
 
@@ -29,7 +29,7 @@ public:
        SmallHeroTag(const BattleState *battle, int heroIndex)
        : battle(battle), index(heroIndex) { }
 
-       void Render(SDL_Surface *screen, int width, int height, geometry::Point<int> position) const;
+       void Render(SDL_Surface *screen, int width, int height, geometry::Vector<int> position) const;
 
 private:
        const BattleState *battle;
index 6aae5d7401395ed3997b4c0b889440d6f280e2e6..a01a8fe0c540dd5b3b5c611b4dff52354fd72b20 100644 (file)
@@ -15,8 +15,6 @@
 #include "../../common/Ikari.h"
 #include "../../common/Item.h"
 #include "../../common/Spell.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
 #include "../../graphics/Animation.h"
 #include "../../graphics/Font.h"
 #include "../../graphics/Frame.h"
@@ -25,7 +23,6 @@
 
 using app::Application;
 using app::Input;
-using geometry::Point;
 using geometry::Vector;
 using graphics::AnimationRunner;
 using std::vector;
@@ -231,9 +228,9 @@ void PerformAttacks::RenderTitleBar(SDL_Surface *screen, const Vector<int> &offs
        if (!titleBarText || !titleBarTimer.Running()) return;
 
        int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight());
-       battle->Res().titleFrame->Draw(screen, Point<int>(offset.X(), offset.Y()), battle->Width(), height);
+       battle->Res().titleFrame->Draw(screen, Vector<int>(offset.X(), offset.Y()), battle->Width(), height);
 
-       Point<int> textPosition(
+       Vector<int> textPosition(
                        (battle->Width() - (std::strlen(titleBarText) * battle->Res().titleFont->CharWidth())) / 2,
                        battle->Res().titleFrame->BorderHeight());
        battle->Res().titleFont->DrawString(titleBarText, screen, textPosition + offset);
@@ -252,13 +249,13 @@ void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry::
        if (!targetAnimation.Valid() || !targetAnimation.Running()) return;
        const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection());
        if (ts.TargetsHeroes()) {
-               for (vector<Point<int> >::size_type i(0), end(battle->NumHeroes()); i < end; ++i) {
+               for (vector<Vector<int> >::size_type i(0), end(battle->NumHeroes()); i < end; ++i) {
                        if (ts.IsSelected(i)) {
                                targetAnimation.DrawCenter(screen, battle->HeroAt(i).Position() + offset);
                        }
                }
        } else {
-               for (vector<Point<int> >::size_type i(0), end(battle->MaxMonsters()); i < end; ++i) {
+               for (vector<Vector<int> >::size_type i(0), end(battle->MaxMonsters()); i < end; ++i) {
                        if (ts.IsSelected(i)) {
                                targetAnimation.DrawCenter(screen, battle->MonsterAt(i).Position() + offset);
                        }
index d060d5a55f38406ed6f0fa11e721fba8569447ad..19c6967379b258cafad54e48ac48ee5ecaccbbbe 100644 (file)
@@ -59,7 +59,7 @@ private:
        app::Timer<Uint32> titleBarTimer;
        app::Timer<Uint32> targetAnimationTimer;
        std::vector<NumberAnimation> numberAnimation;
-       std::vector<geometry::Point<int> > numberPosition;
+       std::vector<geometry::Vector<int> > numberPosition;
        int cursor;
 
 };
index 155313f0f686e675979ad4775815d334a3cc2017..a22f43816a0006612066ba5ad290df8fd070548d 100644 (file)
@@ -10,8 +10,7 @@
 #include "../BattleState.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
+#include "../../geometry/Vector.h"
 #include "../../graphics/Font.h"
 #include "../../graphics/Frame.h"
 
@@ -19,7 +18,6 @@
 
 using app::Application;
 using app::Input;
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
@@ -70,9 +68,9 @@ void RunState::Render(SDL_Surface *screen) {
 
 void RunState::RenderTitleBar(SDL_Surface *screen, const Vector<int> &offset) {
        int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight());
-       battle->Res().titleFrame->Draw(screen, Point<int>(offset.X(), offset.Y()), battle->Width(), height);
+       battle->Res().titleFrame->Draw(screen, Vector<int>(offset.X(), offset.Y()), battle->Width(), height);
 
-       Point<int> textPosition(
+       Vector<int> textPosition(
                        (battle->Width() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2,
                        battle->Res().titleFrame->BorderHeight());
        battle->Res().titleFont->DrawString(battle->Res().escapeText, screen, textPosition + offset);
index 7f366818143ad48c29beeb70ea966b7e85fe085c..fbd43336769f1c3d570c3e867d948b1340accc3c 100644 (file)
 #include "../../app/Application.h"
 #include "../../app/Input.h"
 #include "../../common/Item.h"
-#include "../../geometry/operators.h"
 
 #include <stdexcept>
 
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
@@ -136,7 +134,7 @@ void SelectAttackType::Render(SDL_Surface *screen) {
 }
 
 void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
-       Point<int> position(
+       Vector<int> position(
                        (battle->Width() - battle->GetAttackTypeMenu().Width()) / 2,
                        battle->Height() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2);
        battle->GetAttackTypeMenu().Render(screen, position + offset);
index 4fce8c75b5a1723fb24e50a797322e7bd7f65bc1..7647e2898f2c11cf80b2275c414b651d6048aa77 100644 (file)
 #include "../../app/Input.h"
 #include "../../common/Ikari.h"
 #include "../../common/Item.h"
-#include "../../geometry/Point.h"
-#include "../../geometry/operators.h"
 #include "../../graphics/Frame.h"
 
 using app::Application;
 using app::Input;
 using common::Ikari;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Frame;
 
@@ -111,7 +108,7 @@ void SelectIkari::Render(SDL_Surface *screen) {
 
 void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
        const Frame *frame(battle->Res().selectFrame);
-       Point<int> position(frame->BorderWidth(), frame->BorderHeight());
+       Vector<int> position(frame->BorderWidth(), frame->BorderHeight());
        int width(battle->Width() - 2 * frame->BorderWidth());
        int height(battle->Res().normalFont->CharHeight() * 13);
        frame->Draw(screen, position + offset, width, height);
@@ -119,7 +116,7 @@ void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
 
 void SelectIkari::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight());
        res.normalFont->DrawString(res.itemMenuHeadline, screen, position + offset);
@@ -127,7 +124,7 @@ void SelectIkari::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset)
 
 void SelectIkari::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
        battle->ActiveHero().IkariMenu().Draw(screen, position + offset);
index 4c197ff3c362b42e05e7099b1413c1cc9d2c5cff..f58a78eaf72fa9eb9c658d7f75b5af8ab3fbd395 100644 (file)
 #include "../../app/Application.h"
 #include "../../app/Input.h"
 #include "../../common/Item.h"
-#include "../../geometry/Point.h"
-#include "../../geometry/operators.h"
 #include "../../graphics/Frame.h"
 
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Frame;
 
@@ -110,7 +107,7 @@ void SelectItem::Render(SDL_Surface *screen) {
 
 void SelectItem::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
        const Frame *frame(battle->Res().selectFrame);
-       Point<int> position(frame->BorderWidth(), frame->BorderHeight());
+       Vector<int> position(frame->BorderWidth(), frame->BorderHeight());
        int width(battle->Width() - 2 * frame->BorderWidth());
        int height(battle->Res().normalFont->CharHeight() * 13);
        frame->Draw(screen, position + offset, width, height);
@@ -118,7 +115,7 @@ void SelectItem::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
 
 void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight());
        res.normalFont->DrawString(res.itemMenuHeadline, screen, position + offset);
@@ -126,7 +123,7 @@ void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset)
 
 void SelectItem::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
        battle->ItemMenu().Draw(screen, position + offset);
index 7eb8fbeb1a8d98b860e692c12edaad6fc7d53cdc..b2cac81e7357330918b501ee75dcf056d5b82d0d 100644 (file)
 #include "../MoveMenu.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
-#include "../../geometry/operators.h"
 
 using app::Application;
 using app::Input;
-using geometry::Point;
 using geometry::Vector;
 
 namespace battle {
@@ -83,7 +81,7 @@ void SelectMoveAction::Render(SDL_Surface *screen) {
 }
 
 void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
-       Point<int> position(
+       Vector<int> position(
                        (battle->Width() - battle->GetMoveMenu().Width()) / 2,
                        battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2);
        battle->GetMoveMenu().Render(screen, position + offset);
index 1bc195c12223e2a7d00b95f642da72ef3a15f19c..65cd8ccdc70173c2ab0e9106588ca249a6fb705f 100644 (file)
 #include "../../app/Application.h"
 #include "../../app/Input.h"
 #include "../../common/Spell.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
 #include "../../graphics/Frame.h"
 
 using app::Application;
 using app::Input;
 using common::Spell;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Frame;
 
@@ -111,7 +108,7 @@ void SelectSpell::Render(SDL_Surface *screen) {
 
 void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
        const Frame *frame(battle->Res().selectFrame);
-       Point<int> position(frame->BorderWidth(), frame->BorderHeight());
+       Vector<int> position(frame->BorderWidth(), frame->BorderHeight());
        int width(battle->Width() - 2 * frame->BorderWidth());
        int height(battle->Res().normalFont->CharHeight() * 13);
        frame->Draw(screen, position + offset, width, height);
@@ -119,7 +116,7 @@ void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
 
 void SelectSpell::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight());
        res.normalFont->DrawString(res.spellMenuHeadline, screen, position + offset);
@@ -127,7 +124,7 @@ void SelectSpell::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset)
 
 void SelectSpell::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
        battle->ActiveHero().SpellMenu().Draw(screen, position + offset);
index 37f2da9829d603405b1b546aa446659e239582a5..f15f4558cd8ab8c32e6fe114ba7875b39036a629 100644 (file)
 #include "../BattleState.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
 
 using app::Application;
 using app::Input;
-using geometry::Point;
 using geometry::Vector;
 using std::vector;
 
@@ -93,7 +90,7 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector<int
        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));
-       vector<Point<int> > positions;
+       vector<Vector<int> > positions;
        if (selection->TargetsMonsters()) {
                for (int i(0), end(battle->MaxMonsters()); i < end; ++i) {
                        positions.push_back(battle->MonsterAt(i).Position());
@@ -104,7 +101,7 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector<int
                }
        }
        if (flipFlop) {
-               for (vector<Point<int> >::size_type i(0); i < positions.size(); ++i) {
+               for (vector<Vector<int> >::size_type i(0); i < positions.size(); ++i) {
                        if (selection->IsSelected(i)) {
                                cursorIcon->DrawTopRight(screen, positions[i] + indicatorOffset + offset);
                        }
index 568fe8857fa4e76a16a589395bae0b84cd718ce1..5c83f7403cbfee69c369f99c0a036f733f55157e 100644 (file)
 #include "../BattleState.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
 
 using app::Application;
 using app::Input;
-using geometry::Point;
 using geometry::Vector;
 using std::vector;
 
@@ -127,7 +124,7 @@ void SwapHeroes::RenderCursors(SDL_Surface *screen, const geometry::Vector<int>
        // 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);
-       vector<Point<int> > positions;
+       vector<Vector<int> > positions;
        for (int i(0), end(battle->NumHeroes()); i < end; ++i) {
                Vector<int> positionCorrection(battle->Res().swapCursor->Width() / 2, battle->HeroTagAt(i).HeroSprite()->Height() - battle->Res().swapCursor->Height() / 2);
                // indicator offsets are inverted for heroes
@@ -135,7 +132,7 @@ void SwapHeroes::RenderCursors(SDL_Surface *screen, const geometry::Vector<int>
                positions.push_back(battle->HeroTagPositionAt(i) + battle->HeroTagAt(i).HeroOffset() + positionCorrection);
        }
        if (flipFlop) {
-               for (vector<Point<int> >::size_type i(0); i < positions.size(); ++i) {
+               for (vector<Vector<int> >::size_type i(0); i < positions.size(); ++i) {
                        if (selected == int(i)) {
                                battle->Res().swapCursor->DrawTopRight(screen, positions[i] + offset);
                        }
diff --git a/src/geometry/Point.h b/src/geometry/Point.h
deleted file mode 100644 (file)
index 9d4bd85..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Point.h
- *
- *  Created on: Aug 5, 2012
- *      Author: holy
- */
-
-#ifndef GEOMETRY_POINT_H_
-#define GEOMETRY_POINT_H_
-
-namespace geometry {
-
-template<class T>
-class Point {
-
-public:
-       Point() : x(0), y(0) { }
-       Point(T x, T y) : x(x), y(y) { }
-
-public:
-       T X() const { return x; }
-       T Y() const { return y; }
-
-private:
-       T x, y;
-
-};
-
-}
-
-#endif /* GEOMETRY_POINT_H_ */
index d7d0f3d69139ecb84249d258535f7bd75972fa60..bf647136ddfaa101ee8406b0f8fa36cdccf2a4b4 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef GEOMETRY_VECTOR_H_
 #define GEOMETRY_VECTOR_H_
 
+#include <ostream>
+
 namespace geometry {
 
 template<class Scalar>
@@ -30,6 +32,52 @@ private:
 
 };
 
+
+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>
+inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<T> &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>
+inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<T> &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> &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> &v, T s) {
+       return Vector<T>(v.X() / s, v.Y() / s);
+}
+
+template<class T>
+inline std::ostream &operator <<(std::ostream &out, const Vector<T> &v) {
+       out << '<' << v.X() << ", " << v.Y() << '>';
+       return out;
+}
+
 }
 
 #endif /* GEOMETRY_VECTOR_H_ */
diff --git a/src/geometry/operators.h b/src/geometry/operators.h
deleted file mode 100644 (file)
index 295daa1..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * operators.h
- *
- *  Created on: Aug 6, 2012
- *      Author: holy
- */
-
-#ifndef GEOMETRY_OPERATORS_H_
-#define GEOMETRY_OPERATORS_H_
-
-#include "Point.h"
-#include "Vector.h"
-
-#include <ostream>
-
-namespace geometry {
-
-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>
-inline Point<T> operator +(const Point<T> &lhs, const Vector<T> &rhs) {
-       return Point<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>
-inline Point<T> &operator +=(Point<T> &lhs, const Vector<T> &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>
-inline Point<T> operator -(const Point<T> &lhs, const Vector<T> &rhs) {
-       return Point<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>
-inline Point<T> &operator -=(Point<T> &lhs, const Vector<T> &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 std::ostream &operator <<(std::ostream &out, const Point<T> &p) {
-       out << '(' << p.X() << ", " << p.Y() << ')';
-       return out;
-}
-template<class T>
-inline std::ostream &operator <<(std::ostream &out, const Vector<T> &v) {
-       out << '<' << v.X() << ", " << v.Y() << '>';
-       return out;
-}
-
-}
-
-#endif /* GEOMETRY_OPERATORS_H_ */
index 0baba35d915e2ee91754a64a7028a5bb2a82a4e3..e26bca9c2cc889b9c39ef466442394dfa798d04c 100644 (file)
@@ -12,8 +12,6 @@
 #include "../app/Application.h"
 #include "../app/State.h"
 #include "../app/Timer.h"
-#include "../geometry/operators.h"
-#include "../geometry/Point.h"
 #include "../geometry/Vector.h"
 
 #include <SDL.h>
@@ -91,18 +89,18 @@ public:
        void ChangeSprite(const Sprite *s) { sprite = s; }
        const Sprite *GetSprite() const { return sprite; }
 
-       void Draw(SDL_Surface *dest, geometry::Point<int> position) const {
+       void Draw(SDL_Surface *dest, geometry::Vector<int> position) const {
                sprite->Draw(dest, position + animation->Offset(Frame()), animation->Col(Frame()) + ColOffset(), animation->Row(Frame()) + RowOffset());
        }
-       void DrawTopRight(SDL_Surface *dest, geometry::Point<int> position) const {
+       void DrawTopRight(SDL_Surface *dest, geometry::Vector<int> position) const {
                geometry::Vector<int> offset(-sprite->Width(), 0);
                Draw(dest, position + offset);
        }
-       void DrawCenter(SDL_Surface *dest, geometry::Point<int> position) const {
+       void DrawCenter(SDL_Surface *dest, geometry::Vector<int> position) const {
                geometry::Vector<int> offset(-sprite->Width() / 2, -sprite->Height() / 2);
                Draw(dest, position + offset);
        }
-       void DrawCenterBottom(SDL_Surface *dest, geometry::Point<int> position) const {
+       void DrawCenterBottom(SDL_Surface *dest, geometry::Vector<int> position) const {
                geometry::Vector<int> offset(-sprite->Width() / 2, -sprite->Height());
                Draw(dest, position + offset);
        }
index 1dc90516ccae28455231d7d919b7ba650a891692..a11850001717eae97289cdb2158c8aa129d32c1c 100644 (file)
@@ -7,42 +7,38 @@
 
 #include "Font.h"
 
-#include "../geometry/operators.h"
-#include "../geometry/Vector.h"
-
 #include <cmath>
 
-using geometry::Point;
 using geometry::Vector;
 using std::pow;
 
 namespace graphics {
 
-void Font::DrawChar(char c, SDL_Surface *dest, const Point<int> &position) const {
+void Font::DrawChar(char c, SDL_Surface *dest, const Vector<int> &position) const {
        int col(colOffset + (c % 0x10));
        int row(rowOffset + (c / 0x10));
        sprite->Draw(dest, position, col, row);
 }
 
-void Font::DrawString(const char *s, SDL_Surface *dest, const Point<int> &positionIn, int maxChars) const {
-       Point<int> position(positionIn);
+void Font::DrawString(const char *s, SDL_Surface *dest, const Vector<int> &positionIn, int maxChars) const {
+       Vector<int> position(positionIn);
        Vector<int> step(CharWidth(), 0);
        for (int i(0); s[i] && (maxChars <= 0 || i < maxChars); ++i, position += step) {
                DrawChar(s[i], dest, position);
        }
 }
 
-void Font::DrawDigit(int digit, SDL_Surface *dest, const Point<int> &position) const {
+void Font::DrawDigit(int digit, SDL_Surface *dest, const Vector<int> &position) const {
        DrawChar(digit + 0x30, dest, position);
 }
 
-void Font::DrawNumber(int numberIn, SDL_Surface *dest, const Point<int> &positionIn, int digits) const {
+void Font::DrawNumber(int numberIn, SDL_Surface *dest, const Vector<int> &positionIn, int digits) const {
        int number(numberIn);
        if (digits > 0 && numberIn >= pow(10.0, digits)) {
                numberIn = pow(10.0, digits) - 1;
        }
 
-       Point<int> position(positionIn);
+       Vector<int> position(positionIn);
        Vector<int> step(sprite->Width(), 0);
 
        if (digits > 0) {
index c48ea16a8410269b075fbb801c4d1c17cb921921..86448025992fcbd509e30c1996738a9e8adaba20 100644 (file)
@@ -9,7 +9,7 @@
 #define GRAPHICS_FONT_H_
 
 #include "Sprite.h"
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 #include <SDL.h>
 
@@ -26,10 +26,10 @@ public:
 public:
        int CharWidth() const { return sprite->Width(); }
        int CharHeight() const { return sprite->Height(); }
-       void DrawChar(char c, SDL_Surface *dest, const geometry::Point<int> &position) const;
-       void DrawString(const char *s, SDL_Surface *dest, const geometry::Point<int> &position, int maxChars = 0) const;
-       void DrawDigit(int d, SDL_Surface *dest, const geometry::Point<int> &position) const;
-       void DrawNumber(int n, SDL_Surface *dest, const geometry::Point<int> &position, int digits = 0) 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 maxChars = 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;
 
 private:
        const Sprite *sprite;
index c682fa0f97ca7de495b04914b2c84c03d8c34fc9..1c51c454cad056f9a56f9734e0f490426e2860d4 100644 (file)
@@ -7,12 +7,12 @@
 
 #include "Frame.h"
 
-using geometry::Point;
+using geometry::Vector;
 
 namespace graphics {
 
 // TODO: maybe create a cache for frames?
-void Frame::Draw(SDL_Surface *dest, const Point<int> &position, int width, int height) const {
+void Frame::Draw(SDL_Surface *dest, const Vector<int> &position, int width, int height) const {
        // top-left corner
        SDL_Rect srcRect;
        srcRect.x = xOffset;
index d2e8dd4c02a868d0946d2f243865246a219db0db..74ce1f7600e18198bf4ad5ed46a97df6b6d6860f 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef GRAPHICS_FRAME_H_
 #define GRAPHICS_FRAME_H_
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 #include <SDL.h>
 
@@ -25,7 +25,7 @@ public:
        int MinHeight() const { return 2 * borderHeight; }
        int BorderWidth() const { return borderWidth; }
        int BorderHeight() const { return borderHeight; }
-       void Draw(SDL_Surface *dest, const geometry::Point<int> &position, int width, int height) const;
+       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int width, int height) const;
 
 private:
        SDL_Surface *surface;
index 027d6b1313d541cc0afc7c44ccada3abe967b224..eda9942d4cdb5697b294bf706af3749739d1a8a5 100644 (file)
@@ -7,11 +7,11 @@
 
 #include "Gauge.h"
 
-using geometry::Point;
+using geometry::Vector;
 
 namespace graphics {
 
-void Gauge::Draw(SDL_Surface *dest, const Point<int> &position, int width, Uint8 fill) const {
+void Gauge::Draw(SDL_Surface *dest, const Vector<int> &position, int width, Uint8 fill) const {
        SDL_Rect srcRect, destRect;
 
        int filledWidth = fill * (width - startWidth - endWidth) / 255;
index b5e30c28a305a2327e6c1843301bccbbde6e5f8b..fd81877e0e0828ff0c32dbf7eec20d0166c10aba 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef GRAPHICS_GAUGE_H_
 #define GRAPHICS_GAUGE_H_
 
-#include "../geometry/Point.h"
+#include "../geometry/Vector.h"
 
 #include <SDL.h>
 
@@ -23,7 +23,7 @@ public:
 public:
        int MinWidth() const { return startWidth + endWidth; }
        int Height() const { return height; }
-       void Draw(SDL_Surface *dest, const geometry::Point<int> &position, int width, Uint8 fill) const;
+       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int width, Uint8 fill) const;
 
 private:
        SDL_Surface *surface;
index c879cc979556f9b9c1d94d60f7552f5cf338d36e..f1a6d2580e25e6657a222e038eca393793c8a0ad 100644 (file)
@@ -10,8 +10,6 @@
 
 #include "Font.h"
 #include "Sprite.h"
-#include "../geometry/operators.h"
-#include "../geometry/Point.h"
 #include "../geometry/Vector.h"
 
 #include <vector>
@@ -61,7 +59,7 @@ public:
        void Reserve(int n) { entries.reserve(n); }
        void Clear() { entries.clear(); }
 
-       void Draw(SDL_Surface *dest, const geometry::Point<int> &position) const;
+       void Draw(SDL_Surface *dest, const geometry::Vector<int> &position) const;
 
 private:
        int GetRow(int index) const { return index / cols; }
@@ -196,7 +194,7 @@ void Menu<T>::SelectIndex(int index) {
 
 
 template<class T>
-void Menu<T>::Draw(SDL_Surface *dest, const geometry::Point<int> &position) const {
+void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) const {
        int start(topRow * cols);
        int slots(rows * cols);
        int items(entries.size() - start);
index 87ce8af1b366aaafd750fffd3e0e37e807c6928b..2c092deb2c85f8ae6b807025d4704a5220e247d1 100644 (file)
@@ -7,11 +7,11 @@
 
 #include "Sprite.h"
 
-using geometry::Point;
+using geometry::Vector;
 
 namespace graphics {
 
-void Sprite::Draw(SDL_Surface *dest, const Point<int> &position, int col, int row) const {
+void Sprite::Draw(SDL_Surface *dest, const Vector<int> &position, int col, int row) const {
        SDL_Rect srcRect, destRect;
        srcRect.x = xOffset + col * Width();
        srcRect.y = yOffset + row * Height();
index 6aa6c94d88f4ae78fd8977ae84bb9b61228dbba2..942d98e51e5e7424d791d657aa7ab94d4371ace3 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef GRAPHICS_SPRITE_H_
 #define GRAPHICS_SPRITE_H_
 
-#include "../geometry/operators.h"
-#include "../geometry/Point.h"
 #include "../geometry/Vector.h"
 
 #include <SDL.h>
@@ -25,16 +23,16 @@ public:
 public:
        int Width() const { return width; }
        int Height() const { return height; }
-       void Draw(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const;
-       void DrawTopRight(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
+       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);
                Draw(dest, position + offset, col, row);
        }
-       void DrawCenter(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
+       void DrawCenter(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
                geometry::Vector<int> offset(-Width() / 2, -Height() / 2);
                Draw(dest, position + offset, col, row);
        }
-       void DrawCenterBottom(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
+       void DrawCenterBottom(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
                geometry::Vector<int> offset(-Width() / 2, -Height());
                Draw(dest, position + offset, col, row);
        }
index eed7397ff548a4d65ce968dc4c07f37936ba8288..bebeed106e14bf8520b80b00aa8affaa2b07bc14 100644 (file)
@@ -17,7 +17,6 @@
 #include "common/Inventory.h"
 #include "common/Item.h"
 #include "common/Spell.h"
-#include "geometry/Point.h"
 #include "geometry/Vector.h"
 #include "graphics/ComplexAnimation.h"
 #include "graphics/Font.h"
@@ -48,7 +47,6 @@ using common::Ikari;
 using common::Inventory;
 using common::Item;
 using common::Spell;
-using geometry::Point;
 using geometry::Vector;
 using graphics::ComplexAnimation;
 using graphics::Font;
@@ -82,15 +80,15 @@ int main(int argc, char **argv) {
                // temporary test data
                SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
                PartyLayout monstersLayout;
-               monstersLayout.AddPosition(Point<Uint8>(88, 88));
-               monstersLayout.AddPosition(Point<Uint8>(128, 88));
-               monstersLayout.AddPosition(Point<Uint8>(168, 88));
-               monstersLayout.AddPosition(Point<Uint8>(208, 88));
+               monstersLayout.AddPosition(Vector<Uint8>(88, 88));
+               monstersLayout.AddPosition(Vector<Uint8>(128, 88));
+               monstersLayout.AddPosition(Vector<Uint8>(168, 88));
+               monstersLayout.AddPosition(Vector<Uint8>(208, 88));
                PartyLayout heroesLayout;
-               heroesLayout.AddPosition(Point<Uint8>(48, 136));
-               heroesLayout.AddPosition(Point<Uint8>(128, 136));
-               heroesLayout.AddPosition(Point<Uint8>(80, 152));
-               heroesLayout.AddPosition(Point<Uint8>(160, 152));
+               heroesLayout.AddPosition(Vector<Uint8>(48, 136));
+               heroesLayout.AddPosition(Vector<Uint8>(128, 136));
+               heroesLayout.AddPosition(Vector<Uint8>(80, 152));
+               heroesLayout.AddPosition(Vector<Uint8>(160, 152));
 
                SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
                Sprite monsterSprite(monsterImg, 64, 64);