Merge branch 'master' into libpg
authorPatrik Gornicz <Gornicz.P@gmail.com>
Fri, 1 May 2009 23:10:29 +0000 (19:10 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Fri, 1 May 2009 23:10:29 +0000 (19:10 -0400)
Conflicts:
Makefile

51 files changed:
Makefile
libs/libSDL-1.2.so.0 [moved from libs/libSDL.so with 100% similarity]
libs/libpg.so.0 [new symlink]
src/CollisionInfo.h
src/Effects/Effect.h
src/Effects/Gravity.h
src/Effects/GravityWell.h
src/Effects/Screen.h
src/Entities/Ball.cpp
src/Entities/Ball.h
src/Entities/Entity.cpp
src/Entities/Entity.h
src/Entities/Line.cpp
src/Entities/Line.h
src/Entities/Particle.cpp
src/Entities/Particle.h
src/Entities/PhysicsEntity.cpp
src/Entities/PhysicsEntity.h
src/Entities/Point.cpp
src/Entities/Point.h
src/Entities/Polygon.cpp
src/Entities/Polygon.h
src/Entities/WindParticle.cpp
src/Entities/WindParticle.h
src/Vector2.cpp [deleted file]
src/Vector2.h [deleted file]
src/collisionManager.cpp
src/config/config.cpp
src/config/keys.cpp
src/config/keys.h
src/config/reader.cpp
src/debug.cpp [deleted file]
src/debug.h [deleted file]
src/dir.mk
src/effectManager.cpp
src/effectManager.h
src/entityCreator.h
src/entityManager.cpp
src/game.cpp
src/graphics/graphics.cpp
src/graphics/graphics.h
src/input/inputManager.cpp
src/input/inputManager.h
src/locks/Autolock.cpp [deleted file]
src/locks/Autolock.h [deleted file]
src/locks/Mutex.cpp [deleted file]
src/locks/Mutex.h [deleted file]
src/locks/dir.mk [deleted file]
src/main.cpp
src/mathw.cpp [deleted file]
src/mathw.h [deleted file]

index 9d523b5..6faa1df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,15 +13,19 @@ else
     LIBGL   := -lGL -lGLU
     LIBSDL  := `sdl-config --libs`
 endif
-LIBS        := ${LIBSDL} ${LIBGL}
-
+LIBMY       := -lpg
+LIBS        := ${LIBSDL} ${LIBGL} ${LIBMY}
 
 OPTFLAGS := -O2
 DBGFLAGS := -ggdb
 PRFFLAGS := ${DBGFLAGS} -pg
 MYFLAGS  := -Wall -pedantic -ansi
 
+RPATH    := libs/
+
 VALFLAGS := --leak-check=full
+LNKFLAGS := -Wl,-rpath,${RPATH}
+
 ifeq (${WIN32},1)
     CXXFLAGS    := ${OPTFLAGS}
 else ifeq (${FINAL},1)
@@ -36,7 +40,7 @@ else
     CXX := g++
 endif
 
-DIRS := # := start
+DIRS    := # := start
 
 SRCSDIR := src/
 SRCS    := # := start
@@ -73,8 +77,9 @@ CFGS := # := start
 CFGS += keys.cfg
 CFGS := $(addprefix ${DSTCFGDIR},${CFGS})
 
-SRCLIBSDIR  := libs/
-DSTLIBSDIR  := ${WORKINGDIR}
+LIBSDIRNAME := libs/
+SRCLIBSDIR  := ${LIBSDIRNAME}
+DSTLIBSDIR  := ${WORKINGDIR}${LIBSDIRNAME}
 
 LIBSTXT     := # := start
 LIBSTXT     += COPYING-SDL
@@ -86,7 +91,8 @@ LIBSCPY     := # := start
 ifeq (${WIN32},1)
     LIBSCPY += SDL.dll
 else
-    LIBSCPY += libSDL.so
+    LIBSCPY += libSDL-1.2.so.0
+    LIBSCPY += libpg.so.0
 endif
 LIBSCPY     := $(addprefix ${DSTLIBSDIR},${LIBSCPY})
 
@@ -107,9 +113,16 @@ TARGET      := ${WORKINGDIR}${TARGETNAME}
 
 DEPSBLDDIRS := ${DEPSDIR} $(addprefix ${DEPSDIR},${DIRS})
 OBJSBLDDIRS := ${OBJSDIR} $(addprefix ${OBJSDIR},${DIRS})
-BLDDIRS     := ${OBJSBLDDIRS} ${DEPSBLDDIRS} ${WORKINGDIR} ${DSTCFGDIR}
+
+BLDDIRS     := # := start
+BLDDIRS     += ${OBJSBLDDIRS}
+BLDDIRS     += ${DEPSBLDDIRS}
+BLDDIRS     += ${WORKINGDIR}
+BLDDIRS     += ${DSTCFGDIR}
+BLDDIRS     += ${DSTLIBSDIR}
 
 INCDIRS     := ${SRCSDIR}
+INCFLAGS    := $(addprefix -I, ${INCDIRS})
 
 
 PRNTFMT := printf "%-5s: %s\n"
@@ -137,7 +150,7 @@ all: ${TARGET} ${CFGS} ${LIBSTXT} ${LIBSCPY} ${TXT}
 # how to link the main target
 ${TARGETTMP}: ${OBJS}
        ${Q1}${PRNTFMT} "${CXX}" "$@"
-       ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS}
+       ${Q2}${CXX} ${CXXFLAGS} ${LNKFLAGS} -o $@ $^ ${LIBS}
 
 # rule to copy tmp target to working directory
 ${TARGET}: ${TARGETTMP} | ${WORKINGDIR}
@@ -167,14 +180,14 @@ ${BLDDIRS}:
 # rule to make an object file from a .cpp
 ${OBJSDIR}%.o: ${SRCSDIR}%.cpp | $$(dir $$@)
        ${Q1}${PRNTFMT} "${CXX}" "$@"
-       ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< -I "${INCDIRS}"
+       ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< ${INCFLAGS}
 
 # rule to make a depend file from a .cpp
 #   be clever and escape the / chars in file paths
 #   DON'T simply use another sed delimiter or it can't appear in the file paths
 ${DEPSDIR}%.d: ${SRCSDIR}%.cpp | $$(dir $$@)
        ${Q1}${PRNTFMT} "DEP" "$@"
-       ${Q2}${CXX} -MM ${CXXFLAGS} $< -I "${INCDIRS}" | \
+       ${Q2}${CXX} -MM ${CXXFLAGS} $< ${INCFLAGS} | \
                sed 's/\(^.*\):/$(subst /,\/,${OBJSDIR}\1 $@):/' > $@
 
 CLEANCMDS := cleanbin cleanobjs cleandeps clean cleanall
similarity index 100%
rename from libs/libSDL.so
rename to libs/libSDL-1.2.so.0
diff --git a/libs/libpg.so.0 b/libs/libpg.so.0
new file mode 120000 (symlink)
index 0000000..6b17e3b
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/libpg.so.0
\ No newline at end of file
index 5d9f1f4..c81888b 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef COLLISIONINFO_H
 #define COLLISIONINFO_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 /// ***** Header Class *****
 
index bdf8eb8..9829919 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef EFFECT_H
 #define EFFECT_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 // Mutual headers ...
index 91be413..0b7815d 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef GRAVITY_H
 #define GRAVITY_H
 
+#include <pg/Vector2.h>
+
 #include "Effect.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index ffbd120..443512d 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef GRAVITYWELL_H
 #define GRAVITYWELL_H
 
+#include <pg/Vector2.h>
+
 #include "Effect.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 8ed0091..b572593 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef SCREEN_H
 #define SCREEN_H
 
+#include <pg/Vector2.h>
+
 #include "Effect.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 517c67a..d0563d7 100644 (file)
  */
 
 #include "Ball.h"
-#include "debug.h"
 
-#include "Vector2.h"
+#include <pg/debug.h>
+#include <pg/Vector2.h>
+
 #include "graphics/graphics.h"
 
 
index 4e3219b..e4267e8 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef BALL_H
 #define BALL_H
 
+#include <pg/Vector2.h>
+
 #include "PhysicsEntity.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 847254a..09e27ab 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "Entity.h"
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Constructors/Destructors *****
index 14242bc..e59f4fd 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef ENTITY_H
 #define ENTITY_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Header Class *****
index 3be227a..793b3cf 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "Line.h"
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Constructors/Destructors *****
index e6159d1..a4f94e7 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef LINE_H
 #define LINE_H
 
+#include <pg/Vector2.h>
+
 #include "Particle.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 1d7472d..97cbafb 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "Particle.h"
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Constructors/Destructors *****
index 87b53ac..251c8ef 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef PARTICLE_H
 #define PARTICLE_H
 
+#include <pg/Vector2.h>
+
 #include "Entity.h"
-#include "Vector2.h"
 
 
 /// NOTE to SELF
index d42d271..d20f671 100644 (file)
  */
 
 #include "PhysicsEntity.h"
-#include "debug.h"
+
+#include <pg/debug.h>
+#include <pg/Vector2.h>
 
 #include "effectManager.h"
-#include "Vector2.h"
 
 
 /// ***** Constructors/Destructors *****
index 8e83266..e6f2f36 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef PHYSICS_H
 #define PHYSICS_H
 
+#include <pg/Vector2.h>
+
 #include "Entity.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 3031c6f..7083ba2 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "Point.h"
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Constructors/Destructors *****
index e0277f7..3845e5a 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef POINT_H
 #define POINT_H
 
+#include <pg/Vector2.h>
+
 #include "Particle.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
index 06955c3..9f2eff6 100644 (file)
@@ -16,9 +16,9 @@
  */
 
 #include "Polygon.h"
-#include "debug.h"
 
-#include "Vector2.h"
+#include <pg/debug.h>
+#include <pg/Vector2.h>
 
 #include "graphics/graphics.h"
 
index 5f3781d..6b115fc 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef POLYGON_H
 #define POLYGON_H
 
+#include <pg/Vector2.h>
+
 #include "PhysicsEntity.h"
-#include "Vector2.h"
 
 #include <vector>
 using std::vector;
index bd866ab..dc1274a 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "WindParticle.h"
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 
 /// ***** Constructors/Destructors *****
index d50fbe7..11ddedd 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef WINDPARTICLE_H
 #define WINDPARTICLE_H
 
+#include <pg/Vector2.h>
+
 #include "Point.h"
-#include "Vector2.h"
 
 
 /// ***** Header Class *****
diff --git a/src/Vector2.cpp b/src/Vector2.cpp
deleted file mode 100644 (file)
index 2a8c8af..0000000
+++ /dev/null
@@ -1,148 +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 <http://www.gnu.org/licenses/>.
- */
-
-#include "Vector2.h"
-#include "debug.h"
-
-#include "mathw.h"
-
-/// ***** Constructors/Destructors *****
-
-Vector2::Vector2()
-  : m_fX(0), m_fY(0)
-{
-
-}
-Vector2::Vector2(float fX, float fY)
-  : m_fX(fX), m_fY(fY)
-{
-
-}
-
-/// ***** Public Class Methods *****
-
-void Vector2::zero()
-{
-    m_fX = 0;
-    m_fY = 0;
-}
-void Vector2::unit()
-{
-    float fLen = length();
-
-    m_fX /= fLen;
-    m_fY /= fLen;
-}
-
-float Vector2::angle() const
-{
-    //TODO
-    DASSERT(false);
-    //return atan2A(m_fY,m_fX);
-    return 0;
-}
-float Vector2::length() const
-{
-    return sqrt(sqrLength());
-}
-float Vector2::sqrLength() const
-{
-    return this->dot(*this);
-}
-
-float Vector2::dot(const Vector2& vec) const
-{
-    return m_fX * vec.m_fX + m_fY * vec.m_fY;
-}
-
-
-string Vector2::toString() const
-{
-     // long just to be safe
-    char rgchars[100];
-
-    sprintf(rgchars, "Vector2  X: %f, Y: %f", m_fX, m_fY);
-
-    return rgchars;
-}
-void Vector2::print() const
-{
-    printf("%s\n", toString().c_str());
-}
-
-
-Vector2 Vector2::add(const Vector2& vec) const
-{
-    return Vector2(m_fX + vec.m_fX, m_fY + vec.m_fY);
-}
-Vector2 Vector2::subtract(const Vector2& vec) const
-{
-    return Vector2(m_fX - vec.m_fX, m_fY - vec.m_fY);
-}
-Vector2 Vector2::multiply(float f) const
-{
-    return Vector2(m_fX * f, m_fY * f);
-}
-Vector2 Vector2::divide(float f) const
-{
-    return Vector2(m_fX / f, m_fY / f);
-}
-
-/// ***** Public Methods *****
-
-Vector2 operator+(const Vector2& vec1, const Vector2& vec2)
-{
-    return vec1.add(vec2);
-}
-Vector2 operator-(const Vector2& vec1, const Vector2& vec2)
-{
-    return vec1.subtract(vec2);
-}
-Vector2 operator*(float f, const Vector2& vec)
-{
-    return vec.multiply(f);
-}
-Vector2 operator*(const Vector2& vec, float f)
-{
-    return vec.multiply(f);
-}
-Vector2 operator/(const Vector2& vec, float f)
-{
-    return vec.divide(f);
-}
-
-
-void operator+=(Vector2& vec1, const Vector2& vec2)
-{
-    vec1.m_fX += vec2.m_fX;
-    vec1.m_fY += vec2.m_fY;
-}
-void operator-=(Vector2& vec1, const Vector2& vec2)
-{
-    vec1.m_fX -= vec2.m_fX;
-    vec1.m_fY -= vec2.m_fY;
-}
-void operator*=(Vector2& vec, float f)
-{
-    vec.m_fX *= f;
-    vec.m_fY *= f;
-}
-void operator/=(Vector2& vec, float f)
-{
-    vec.m_fX /= f;
-    vec.m_fY /= f;
-}
diff --git a/src/Vector2.h b/src/Vector2.h
deleted file mode 100644 (file)
index 57a5541..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef VECTOR2_H
-#define VECTOR2_H
-
-#include <string>
-
-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
index dc5a785..1076ccc 100644 (file)
  */
 
 #include "collisionManager.h"
-#include "debug.h"
 
-#include "Vector2.h"
+#include <pg/debug.h>
+#include <pg/Vector2.h>
+#include <pg/mathw.h>
 
 #include "Entities/Ball.h"
 #include "Entities/Polygon.h"
@@ -26,8 +27,6 @@
 
 #include "CollisionInfo.h"
 
-#include "mathw.h"
-
 /// ***** Private Method Headers *****
 
 static void clearEntities();
index 709c5ff..88768f3 100644 (file)
@@ -16,7 +16,8 @@
  */
 
 #include "config.h"
-#include "debug.h"
+
+#include <pg/debug.h>
 
 #include <SDL/SDL.h>
 #include "keys.h"
index 8832be5..b2e9917 100644 (file)
@@ -16,7 +16,8 @@
  */
 
 #include "keys.h"
-#include "debug.h"
+
+#include <pg/debug.h>
 
 #include <SDL/SDL.h>
 
index 285ecb6..6a0d0db 100644 (file)
 #ifndef KEYS_H
 #define KEYS_H
 
+#include <pg/debug.h>
+
 #include <SDL/SDL.h>
 
 #include <map>
 #include <string>
 
-#include "debug.h"
-
 /// ***** Header Methods *****
 namespace key
 {
index 716ec36..3f370e3 100644 (file)
@@ -16,7 +16,8 @@
  */
 
 #include "reader.h"
-#include "debug.h"
+
+#include <pg/debug.h>
 
 #include <iostream>
 using std::cerr;
diff --git a/src/debug.cpp b/src/debug.cpp
deleted file mode 100644 (file)
index 4e659d2..0000000
+++ /dev/null
@@ -1,56 +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 <http://www.gnu.org/licenses/>.
- */
-
-#include "debug.h"
-
-#include <iostream>
-using std::cerr;
-using std::cout;
-using std::endl;
-
-#include <assert.h>
-
-#include "locks/Mutex.h"
-#include "locks/Autolock.h"
-
-/// ***** Public Methods *****
-
-Mutex muDPF;
-
-void DPF(int level, const char* pstr)
-{
-    Autolock lock(muDPF);
-
-    cout << pstr << endl;
-}
-
-void debug::init()
-{
-    muDPF.init();
-}
-
-void debug::clean()
-{
-    muDPF.clean();
-}
-
-void DASSERT(bool fBreak)
-{
-    assert(fBreak);
-}
-
-/// ***** Private Methods *****
diff --git a/src/debug.h b/src/debug.h
deleted file mode 100644 (file)
index 6085003..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include <iostream>
-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
index 303c805..4c30aa9 100644 (file)
@@ -2,9 +2,7 @@ NEWSRCS := # insure blank
 
 NEWSRCS += game.cpp
 NEWSRCS += main.cpp
-NEWSRCS += mathw.cpp
 NEWSRCS += ticks.cpp
-NEWSRCS += Vector2.cpp
 NEWSRCS += handleSignal.cpp
 
 NEWSRCS += entityCreator.cpp
@@ -13,8 +11,6 @@ NEWSRCS += effectManager.cpp
 NEWSRCS += collisionManager.cpp
 NEWSRCS += CollisionInfo.cpp
 
-NEWSRCS += debug.cpp
-
 
 NEWDIRS := # insure blank
 
@@ -24,7 +20,6 @@ NEWDIRS += Effects/
 NEWDIRS += config/
 NEWDIRS += input/
 NEWDIRS += graphics/
-NEWDIRS += locks/
 
 
 # Post dir setup
index c11ffc3..bcd597e 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "effectManager.h"
 
+#include <pg/Vector2.h>
+
 #include <set>
 
 #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"
 
index f77e191..b649239 100644 (file)
@@ -18,7 +18,8 @@
 #ifndef EFFECTMANAGER_H
 #define EFFECTMANAGER_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
+
 #include "Entities/PhysicsEntity.h"
 
 /// ***** Header Methods *****
index 4c1b4c1..b0b0974 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef ENTITYCREATOR_H
 #define ENTITYCREATOR_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
 
 /// ***** Header Methods *****
 namespace creator
index 64d7480..62bcb2e 100644 (file)
  */
 
 #include "entityManager.h"
-#include "debug.h"
+
+#include <pg/debug.h>
+#include <pg/Mutex.h>
+#include <pg/Autolock.h>
 
 #include <set>
 #include <SDL/SDL.h>
 
-#include "locks/Mutex.h"
-#include "locks/Autolock.h"
-
 #include "Entities/Entity.h"
 #include "Entities/Particle.h"
 #include "Entities/PhysicsEntity.h"
index e8c37a2..3cab823 100644 (file)
@@ -16,7 +16,8 @@
  */
 
 #include "game.h"
-#include "debug.h"
+
+#include <pg/debug.h>
 
 #include <vector>
 using std::vector;
index 6939824..55e2337 100644 (file)
  */
 
 #include "graphics.h"
-#include "debug.h"
+
+#include <pg/debug.h>
+#include <pg/mathw.h>
 
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <SDL/SDL.h>
 #include <cmath>
 
-#include "mathw.h"
-
 #include <iostream>
 using std::cerr;
 using std::cout;
index aa87e1b..94a2d5c 100644 (file)
@@ -18,7 +18,8 @@
 #ifndef GRAPHICS_H
 #define GRAPHICS_H
 
-#include "Vector2.h"
+#include <pg/Vector2.h>
+
 #include <vector>
 
 
index 5a42b2c..3d94d30 100644 (file)
@@ -16,7 +16,8 @@
  */
 
 #include "inputManager.h"
-#include "debug.h"
+
+#include <pg/debug.h>
 
 #include <SDL/SDL.h>
 
index 7d156c4..6abc39f 100644 (file)
@@ -18,8 +18,9 @@
 #ifndef INPUT_H
 #define INPUT_H
 
+#include <pg/Vector2.h>
+
 #include <SDL/SDL.h>
-#include "Vector2.h"
 
 /// ***** Header Methods *****
 
diff --git a/src/locks/Autolock.cpp b/src/locks/Autolock.cpp
deleted file mode 100644 (file)
index 3601bdf..0000000
+++ /dev/null
@@ -1,42 +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 <http://www.gnu.org/licenses/>.
- */
-
-#include "Autolock.h"
-
-#include "Mutex.h"
-
-/// ***** Constructors/Destructors *****
-Autolock::Autolock(Mutex& mu)
-    : m_mu(mu)
-{
-    Lock();
-}
-
-Autolock::~Autolock()
-{
-    Unlock();
-}
-
-void Autolock::Lock()
-{
-    m_mu.Lock();
-}
-
-void Autolock::Unlock()
-{
-    m_mu.Unlock();
-}
diff --git a/src/locks/Autolock.h b/src/locks/Autolock.h
deleted file mode 100644 (file)
index de0107c..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-
-
-#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.cpp b/src/locks/Mutex.cpp
deleted file mode 100644 (file)
index e4004c6..0000000
+++ /dev/null
@@ -1,61 +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 <http://www.gnu.org/licenses/>.
- */
-
-#include "Mutex.h"
-#include "debug.h"
-
-#include <SDL/SDL.h>
-
-Mutex::Mutex()
-    : m_pSDL_mutex(NULL)
-{
-
-}
-Mutex::~Mutex()
-{
-
-}
-
-void Mutex::init()
-{
-    m_pSDL_mutex = SDL_CreateMutex();
-}
-void Mutex::clean()
-{
-    SDL_DestroyMutex(m_pSDL_mutex);
-    m_pSDL_mutex = NULL;
-}
-
-bool Mutex::IsValid()
-{
-    return NULL != m_pSDL_mutex;
-}
-
-void Mutex::Lock()
-{
-    DASSERT(IsValid());
-
-    SDL_mutexP(m_pSDL_mutex);
-    m_uiThreadID = SDL_ThreadID();
-}
-void Mutex::Unlock()
-{
-    DASSERT(IsValid());
-
-    DASSERT(m_uiThreadID == SDL_ThreadID());
-    SDL_mutexV(m_pSDL_mutex);
-}
diff --git a/src/locks/Mutex.h b/src/locks/Mutex.h
deleted file mode 100644 (file)
index cac4d94..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-
-
-#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/locks/dir.mk b/src/locks/dir.mk
deleted file mode 100644 (file)
index f7e8b9e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-NEWSRCS := # insure blank
-
-NEWSRCS += Autolock.cpp
-NEWSRCS += Mutex.cpp
-
-
-# Post dir setup
-
-CURDIR         := locks/
-
-NEWSRCS := $(addprefix ${CURDIR},${NEWSRCS})
-NEWOBJS := ${NEWSRCS:.cpp=.o}
-NEWDEPS := ${NEWSRCS:.cpp=.d}
-
-# Append to lists
-
-SRCS    += ${NEWSRCS}
-OBJS    += $(addprefix ${OBJSDIR},${NEWOBJS})
-DEPS    += $(addprefix ${DEPSDIR},${NEWDEPS})
index c9e8808..34aa2ce 100644 (file)
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <pg/debug.h>
+
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <SDL/SDL.h>
 
-#include "debug.h"
 #include "handleSignal.h"
 
 #include "game.h"
diff --git a/src/mathw.cpp b/src/mathw.cpp
deleted file mode 100644 (file)
index 2b71dec..0000000
+++ /dev/null
@@ -1,71 +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 <http://www.gnu.org/licenses/>.
- */
-
-#include "mathw.h"
-
-
-/// ***** Public Methods *****
-
-int mod(int x, int y)
-{
-  return x % y + (x < 0 ? y : 0);
-}
-
-// Vector2 Math
-
-Vector2 vectorToLine
-(
-  const Vector2& vec,
-  float x1,
-  float y1,
-  float x2,
-  float y2
-)
-{
-    float lineSize = (float) sqrt((x1 - x2) * (x1 - x2)
-                                + (y1 - y2) * (y1 - y2));
-    if (lineSize == 0)
-        return Vector2(x1 - vec.m_fX, y1 - vec.m_fY);
-
-    float u = ((vec.m_fX - x1) * (x2 - x1)
-             + (vec.m_fY - y1) * (y2 - y1)) / (lineSize * lineSize);
-
-    if (u < 0)
-        return Vector2(x1 - vec.m_fX, y1 - vec.m_fY);
-    else if (u > 1)
-        return Vector2(x2 - vec.m_fX, y2 - vec.m_fY);
-    else
-    {
-        float ix = x1 + u * (x2 - x1);
-        float iy = y1 + u * (y2 - y1);
-        return Vector2(ix - vec.m_fX, iy - vec.m_fY);
-    }
-}
-
-Vector2 perp(const Vector2& vec)
-{
-  return Vector2(-vec.m_fY, vec.m_fX);
-}
-
-float dot(const Vector2& vec1, const Vector2& vec2)
-{
-  return vec1.m_fX * vec2.m_fX + vec1.m_fY * vec2.m_fY;
-}
-
-//TODO float Vector2::projectionCoeff(const Vector2* vec) const;
-//TODO Vector2* Vector2::projection(const Vector2* vec) const;
-
diff --git a/src/mathw.h b/src/mathw.h
deleted file mode 100644 (file)
index 26a92d8..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MATHW_H
-#define MATHW_H
-
-#include <math.h>
-#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