From f32a9b7c8eab3536ad354f85ee65c41d5b5da006 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Tue, 28 Apr 2009 17:26:03 -0400 Subject: [PATCH] changed src so the libpg headers are now used --- src/CollisionInfo.h | 2 +- src/Effects/Effect.h | 2 +- src/Effects/Gravity.h | 3 +- src/Effects/GravityWell.h | 3 +- src/Effects/Screen.h | 3 +- src/Entities/Ball.cpp | 5 +-- src/Entities/Ball.h | 3 +- src/Entities/Entity.cpp | 2 +- src/Entities/Entity.h | 2 +- src/Entities/Line.cpp | 2 +- src/Entities/Line.h | 3 +- src/Entities/Particle.cpp | 2 +- src/Entities/Particle.h | 3 +- src/Entities/PhysicsEntity.cpp | 5 +-- src/Entities/PhysicsEntity.h | 3 +- src/Entities/Point.cpp | 2 +- src/Entities/Point.h | 3 +- src/Entities/Polygon.cpp | 4 +-- src/Entities/Polygon.h | 3 +- src/Entities/WindParticle.cpp | 2 +- src/Entities/WindParticle.h | 3 +- src/Vector2.h | 69 ------------------------------------------ src/collisionManager.cpp | 7 ++--- src/config/config.cpp | 3 +- src/config/keys.cpp | 3 +- src/config/keys.h | 4 +-- src/config/reader.cpp | 3 +- src/debug.h | 40 ------------------------ src/effectManager.cpp | 3 +- src/effectManager.h | 3 +- src/entityCreator.h | 2 +- src/entityManager.cpp | 8 ++--- src/game.cpp | 3 +- src/graphics/graphics.cpp | 6 ++-- src/graphics/graphics.h | 3 +- src/input/inputManager.cpp | 3 +- src/input/inputManager.h | 3 +- src/locks/Autolock.h | 45 --------------------------- src/locks/Mutex.h | 50 ------------------------------ src/main.cpp | 3 +- src/mathw.h | 54 --------------------------------- 41 files changed, 69 insertions(+), 306 deletions(-) delete mode 100644 src/Vector2.h delete mode 100644 src/debug.h delete mode 100644 src/locks/Autolock.h delete mode 100644 src/locks/Mutex.h delete mode 100644 src/mathw.h diff --git a/src/CollisionInfo.h b/src/CollisionInfo.h index 5d9f1f4..c81888b 100644 --- a/src/CollisionInfo.h +++ b/src/CollisionInfo.h @@ -19,7 +19,7 @@ #ifndef COLLISIONINFO_H #define COLLISIONINFO_H -#include "Vector2.h" +#include /// ***** Header Class ***** diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h index bdf8eb8..9829919 100644 --- a/src/Effects/Effect.h +++ b/src/Effects/Effect.h @@ -18,7 +18,7 @@ #ifndef EFFECT_H #define EFFECT_H -#include "Vector2.h" +#include // Mutual headers ... diff --git a/src/Effects/Gravity.h b/src/Effects/Gravity.h index 91be413..0b7815d 100644 --- a/src/Effects/Gravity.h +++ b/src/Effects/Gravity.h @@ -18,8 +18,9 @@ #ifndef GRAVITY_H #define GRAVITY_H +#include + #include "Effect.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Effects/GravityWell.h b/src/Effects/GravityWell.h index ffbd120..443512d 100644 --- a/src/Effects/GravityWell.h +++ b/src/Effects/GravityWell.h @@ -18,8 +18,9 @@ #ifndef GRAVITYWELL_H #define GRAVITYWELL_H +#include + #include "Effect.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Effects/Screen.h b/src/Effects/Screen.h index 8ed0091..b572593 100644 --- a/src/Effects/Screen.h +++ b/src/Effects/Screen.h @@ -18,8 +18,9 @@ #ifndef SCREEN_H #define SCREEN_H +#include + #include "Effect.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Entities/Ball.cpp b/src/Entities/Ball.cpp index 517c67a..d0563d7 100644 --- a/src/Entities/Ball.cpp +++ b/src/Entities/Ball.cpp @@ -16,9 +16,10 @@ */ #include "Ball.h" -#include "debug.h" -#include "Vector2.h" +#include +#include + #include "graphics/graphics.h" diff --git a/src/Entities/Ball.h b/src/Entities/Ball.h index 4e3219b..e4267e8 100644 --- a/src/Entities/Ball.h +++ b/src/Entities/Ball.h @@ -18,8 +18,9 @@ #ifndef BALL_H #define BALL_H +#include + #include "PhysicsEntity.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 847254a..09e27ab 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -17,7 +17,7 @@ #include "Entity.h" -#include "Vector2.h" +#include /// ***** Constructors/Destructors ***** diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 14242bc..e59f4fd 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -18,7 +18,7 @@ #ifndef ENTITY_H #define ENTITY_H -#include "Vector2.h" +#include /// ***** Header Class ***** diff --git a/src/Entities/Line.cpp b/src/Entities/Line.cpp index 3be227a..793b3cf 100644 --- a/src/Entities/Line.cpp +++ b/src/Entities/Line.cpp @@ -17,7 +17,7 @@ #include "Line.h" -#include "Vector2.h" +#include /// ***** Constructors/Destructors ***** diff --git a/src/Entities/Line.h b/src/Entities/Line.h index e6159d1..a4f94e7 100644 --- a/src/Entities/Line.h +++ b/src/Entities/Line.h @@ -18,8 +18,9 @@ #ifndef LINE_H #define LINE_H +#include + #include "Particle.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Entities/Particle.cpp b/src/Entities/Particle.cpp index 1d7472d..97cbafb 100644 --- a/src/Entities/Particle.cpp +++ b/src/Entities/Particle.cpp @@ -17,7 +17,7 @@ #include "Particle.h" -#include "Vector2.h" +#include /// ***** Constructors/Destructors ***** diff --git a/src/Entities/Particle.h b/src/Entities/Particle.h index 87b53ac..251c8ef 100644 --- a/src/Entities/Particle.h +++ b/src/Entities/Particle.h @@ -18,8 +18,9 @@ #ifndef PARTICLE_H #define PARTICLE_H +#include + #include "Entity.h" -#include "Vector2.h" /// NOTE to SELF diff --git a/src/Entities/PhysicsEntity.cpp b/src/Entities/PhysicsEntity.cpp index d42d271..d20f671 100644 --- a/src/Entities/PhysicsEntity.cpp +++ b/src/Entities/PhysicsEntity.cpp @@ -16,10 +16,11 @@ */ #include "PhysicsEntity.h" -#include "debug.h" + +#include +#include #include "effectManager.h" -#include "Vector2.h" /// ***** Constructors/Destructors ***** diff --git a/src/Entities/PhysicsEntity.h b/src/Entities/PhysicsEntity.h index 8e83266..e6f2f36 100644 --- a/src/Entities/PhysicsEntity.h +++ b/src/Entities/PhysicsEntity.h @@ -18,8 +18,9 @@ #ifndef PHYSICS_H #define PHYSICS_H +#include + #include "Entity.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Entities/Point.cpp b/src/Entities/Point.cpp index 3031c6f..7083ba2 100644 --- a/src/Entities/Point.cpp +++ b/src/Entities/Point.cpp @@ -17,7 +17,7 @@ #include "Point.h" -#include "Vector2.h" +#include /// ***** Constructors/Destructors ***** diff --git a/src/Entities/Point.h b/src/Entities/Point.h index e0277f7..3845e5a 100644 --- a/src/Entities/Point.h +++ b/src/Entities/Point.h @@ -18,8 +18,9 @@ #ifndef POINT_H #define POINT_H +#include + #include "Particle.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Entities/Polygon.cpp b/src/Entities/Polygon.cpp index 06955c3..9f2eff6 100644 --- a/src/Entities/Polygon.cpp +++ b/src/Entities/Polygon.cpp @@ -16,9 +16,9 @@ */ #include "Polygon.h" -#include "debug.h" -#include "Vector2.h" +#include +#include #include "graphics/graphics.h" diff --git a/src/Entities/Polygon.h b/src/Entities/Polygon.h index 5f3781d..6b115fc 100644 --- a/src/Entities/Polygon.h +++ b/src/Entities/Polygon.h @@ -18,8 +18,9 @@ #ifndef POLYGON_H #define POLYGON_H +#include + #include "PhysicsEntity.h" -#include "Vector2.h" #include using std::vector; diff --git a/src/Entities/WindParticle.cpp b/src/Entities/WindParticle.cpp index bd866ab..dc1274a 100644 --- a/src/Entities/WindParticle.cpp +++ b/src/Entities/WindParticle.cpp @@ -17,7 +17,7 @@ #include "WindParticle.h" -#include "Vector2.h" +#include /// ***** Constructors/Destructors ***** diff --git a/src/Entities/WindParticle.h b/src/Entities/WindParticle.h index d50fbe7..11ddedd 100644 --- a/src/Entities/WindParticle.h +++ b/src/Entities/WindParticle.h @@ -18,8 +18,9 @@ #ifndef WINDPARTICLE_H #define WINDPARTICLE_H +#include + #include "Point.h" -#include "Vector2.h" /// ***** Header Class ***** diff --git a/src/Vector2.h b/src/Vector2.h deleted file mode 100644 index 57a5541..0000000 --- a/src/Vector2.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef VECTOR2_H -#define VECTOR2_H - -#include - -using std::string; - -/// ***** Header Class ***** -class Vector2 -{ - public: - float m_fX; - float m_fY; - - Vector2(); - Vector2(float, float); - - void zero(); - void unit(); - - float angle() const; - float length() const; - float sqrLength() const; - - float dot(const Vector2&) const; - - Vector2 add(const Vector2&) const; - Vector2 subtract(const Vector2&) const; - Vector2 divide(float) const; - Vector2 multiply(float) const; - - string toString() const; - void print() const; -}; - -/// ***** Header Methods ***** - -// definitions of the operators are external because (float, Vector2) would -// fail inside the class - -Vector2 operator+(const Vector2&, const Vector2&); -Vector2 operator-(const Vector2&, const Vector2&); -Vector2 operator*(float, const Vector2&); -Vector2 operator*(const Vector2&, float); -Vector2 operator/(const Vector2&, float); - -void operator+=(Vector2&, const Vector2&); -void operator-=(Vector2&, const Vector2&); -void operator*=(Vector2&, float); -void operator/=(Vector2&, float); - -#endif // VECTOR2_H diff --git a/src/collisionManager.cpp b/src/collisionManager.cpp index dc5a785..1076ccc 100644 --- a/src/collisionManager.cpp +++ b/src/collisionManager.cpp @@ -16,9 +16,10 @@ */ #include "collisionManager.h" -#include "debug.h" -#include "Vector2.h" +#include +#include +#include #include "Entities/Ball.h" #include "Entities/Polygon.h" @@ -26,8 +27,6 @@ #include "CollisionInfo.h" -#include "mathw.h" - /// ***** Private Method Headers ***** static void clearEntities(); diff --git a/src/config/config.cpp b/src/config/config.cpp index 709c5ff..88768f3 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -16,7 +16,8 @@ */ #include "config.h" -#include "debug.h" + +#include #include #include "keys.h" diff --git a/src/config/keys.cpp b/src/config/keys.cpp index 8832be5..b2e9917 100644 --- a/src/config/keys.cpp +++ b/src/config/keys.cpp @@ -16,7 +16,8 @@ */ #include "keys.h" -#include "debug.h" + +#include #include diff --git a/src/config/keys.h b/src/config/keys.h index 285ecb6..6a0d0db 100644 --- a/src/config/keys.h +++ b/src/config/keys.h @@ -19,13 +19,13 @@ #ifndef KEYS_H #define KEYS_H +#include + #include #include #include -#include "debug.h" - /// ***** Header Methods ***** namespace key { diff --git a/src/config/reader.cpp b/src/config/reader.cpp index 716ec36..3f370e3 100644 --- a/src/config/reader.cpp +++ b/src/config/reader.cpp @@ -16,7 +16,8 @@ */ #include "reader.h" -#include "debug.h" + +#include #include using std::cerr; diff --git a/src/debug.h b/src/debug.h deleted file mode 100644 index 6085003..0000000 --- a/src/debug.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef DEBUG_H -#define DEBUG_H - -#include -using std::cout; -using std::cerr; -using std::endl; - -void DPF(int level, const char* pstr); - -namespace debug -{ - void init(); - void clean(); -} - -void DASSERT(bool fBreak); - -// comment out when not debugging -#define DEBUGGING - - -#endif // DEBUG_H diff --git a/src/effectManager.cpp b/src/effectManager.cpp index c11ffc3..bcd597e 100644 --- a/src/effectManager.cpp +++ b/src/effectManager.cpp @@ -17,6 +17,8 @@ #include "effectManager.h" +#include + #include #include "Effects/Effect.h" @@ -24,7 +26,6 @@ #include "Effects/GravityWell.h" #include "Effects/Screen.h" -#include "Vector2.h" #include "input/inputManager.h" #include "config/config.h" diff --git a/src/effectManager.h b/src/effectManager.h index f77e191..b649239 100644 --- a/src/effectManager.h +++ b/src/effectManager.h @@ -18,7 +18,8 @@ #ifndef EFFECTMANAGER_H #define EFFECTMANAGER_H -#include "Vector2.h" +#include + #include "Entities/PhysicsEntity.h" /// ***** Header Methods ***** diff --git a/src/entityCreator.h b/src/entityCreator.h index 4c1b4c1..b0b0974 100644 --- a/src/entityCreator.h +++ b/src/entityCreator.h @@ -18,7 +18,7 @@ #ifndef ENTITYCREATOR_H #define ENTITYCREATOR_H -#include "Vector2.h" +#include /// ***** Header Methods ***** namespace creator diff --git a/src/entityManager.cpp b/src/entityManager.cpp index 64d7480..62bcb2e 100644 --- a/src/entityManager.cpp +++ b/src/entityManager.cpp @@ -16,14 +16,14 @@ */ #include "entityManager.h" -#include "debug.h" + +#include +#include +#include #include #include -#include "locks/Mutex.h" -#include "locks/Autolock.h" - #include "Entities/Entity.h" #include "Entities/Particle.h" #include "Entities/PhysicsEntity.h" diff --git a/src/game.cpp b/src/game.cpp index e8c37a2..3cab823 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -16,7 +16,8 @@ */ #include "game.h" -#include "debug.h" + +#include #include using std::vector; diff --git a/src/graphics/graphics.cpp b/src/graphics/graphics.cpp index 6939824..55e2337 100644 --- a/src/graphics/graphics.cpp +++ b/src/graphics/graphics.cpp @@ -16,15 +16,15 @@ */ #include "graphics.h" -#include "debug.h" + +#include +#include #include #include #include #include -#include "mathw.h" - #include using std::cerr; using std::cout; diff --git a/src/graphics/graphics.h b/src/graphics/graphics.h index aa87e1b..94a2d5c 100644 --- a/src/graphics/graphics.h +++ b/src/graphics/graphics.h @@ -18,7 +18,8 @@ #ifndef GRAPHICS_H #define GRAPHICS_H -#include "Vector2.h" +#include + #include diff --git a/src/input/inputManager.cpp b/src/input/inputManager.cpp index 5a42b2c..3d94d30 100644 --- a/src/input/inputManager.cpp +++ b/src/input/inputManager.cpp @@ -16,7 +16,8 @@ */ #include "inputManager.h" -#include "debug.h" + +#include #include diff --git a/src/input/inputManager.h b/src/input/inputManager.h index 7d156c4..6abc39f 100644 --- a/src/input/inputManager.h +++ b/src/input/inputManager.h @@ -18,8 +18,9 @@ #ifndef INPUT_H #define INPUT_H +#include + #include -#include "Vector2.h" /// ***** Header Methods ***** diff --git a/src/locks/Autolock.h b/src/locks/Autolock.h deleted file mode 100644 index de0107c..0000000 --- a/src/locks/Autolock.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef AUTOLOCK_H -#define AUTOLOCK_H - -class Mutex; - -/// ***** Header Class ***** -class Autolock -{ -public: - Autolock(Mutex& mu); - ~Autolock(); - - void Lock(); - void Unlock(); - -// hide copying methods! -private: - Autolock(const Autolock&); - const Autolock& operator ==(const Autolock&); - -private: - Mutex& m_mu; -}; - -/// ***** Header Methods ***** - -#endif // AUTOLOCK_H diff --git a/src/locks/Mutex.h b/src/locks/Mutex.h deleted file mode 100644 index cac4d94..0000000 --- a/src/locks/Mutex.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MUTEX_H -#define MUTEX_H - -/// ***** Header Class ***** - -class SDL_mutex; - -class Mutex -{ -public: - Mutex(); - ~Mutex(); - - void init(); - void clean(); - - bool IsValid(); - - void Lock(); - void Unlock(); - -// hide copying methods! -private: - Mutex(const Mutex&); - const Mutex& operator ==(const Mutex&); - -private: - SDL_mutex* m_pSDL_mutex; - unsigned int m_uiThreadID; -}; - -#endif // MUTEX_H diff --git a/src/main.cpp b/src/main.cpp index c9e8808..34aa2ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,11 +15,12 @@ * along with this program. If not, see . */ +#include + #include #include #include -#include "debug.h" #include "handleSignal.h" #include "game.h" diff --git a/src/mathw.h b/src/mathw.h deleted file mode 100644 index 26a92d8..0000000 --- a/src/mathw.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MATHW_H -#define MATHW_H - -#include -#include "Vector2.h" - - -/// ***** Public Variables ***** - -static const float PI = 3.1415926535897; - -/// ***** Header Methods ***** - -int mod(int, int); - -/// Vector2 Math - -Vector2 vectorToLine -( - const Vector2& vec, - float x1, - float y1, - float x2, - float y2 -); - -//Vector2 lineIntersection(Vector2&, Vector2&, Vector2&, Vector2&) const; - -//void Rotate(float rads); - -float dot(const Vector2&, const Vector2&); -Vector2 perp(const Vector2&); - -//TODO float projectionCoeff(const Vector2&, const Vector2&) const; -//TODO void projection(const Vector2&, const Vector2&); - -#endif // MATHW_H -- 2.10.2