graphics moved to folder, Make flags updated
authorPatrik Gornicz <Gornicz.P@gmail.com>
Thu, 17 Jul 2008 02:30:47 +0000 (22:30 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Thu, 17 Jul 2008 02:30:47 +0000 (22:30 -0400)
src/Entities/Ball.cpp
src/Makefile
src/depend.mk
src/graphics/graphics.cpp [moved from src/graphics.cpp with 92% similarity]
src/graphics/graphics.h [moved from src/graphics.h with 58% similarity]
src/main.cpp

index 7c31364..ad24d8e 100644 (file)
@@ -1,5 +1,6 @@
 #include "Ball.h"
 #include "../Vector2.h"
+#include "../graphics/graphics.h"
 
 /// ***** Public Class Methods *****
 Ball::Ball(Vector2 pos, float radius)
@@ -15,4 +16,6 @@ Ball::~Ball()
 void Ball::draw() const
 {
     // TODO
+
+    glDrawCircle(radius, &position);
 }
index 4a51706..1d89438 100644 (file)
@@ -1,14 +1,18 @@
 
-LIBGL = -lGL -lGLU
-LIBSDL = `sdl-config --libs`
-LIBS = ${LIBSDL} ${LIBGL}
+LIBGL := -lGL -lGLU
+LIBSDL := `sdl-config --libs`
+LIBS := ${LIBSDL} ${LIBGL}
+
+OPTFLAGS := -O2
+DBGFLAGS := -ggdb
+PRFFLAGS := ${DBGFLAGS} -pg
+
+#CXX := g++
+CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS}
 
-CXX = g++
-CXXFLAGS = -ggdb -Wall -pedantic
 
 SRCS := entityManager.cpp
 SRCS += game.cpp
-SRCS += graphics.cpp
 SRCS += main.cpp
 SRCS += mathw.cpp
 SRCS += ticks.cpp
@@ -30,10 +34,13 @@ SRCS += GameStates/Running.cpp
 
 SRCS += input/inputManager.cpp
 
-OBJS = ${SRCS:.cpp=.o}
+SRCS += graphics/graphics.cpp
+
+OBJS := ${SRCS:.cpp=.o}
+
 
-TARGET = ../run_physics
-DEPEND = depend.mk
+TARGET := ../run_physics
+DEPEND := depend.mk
 
 
 .PHONY: all
index 9eb1e16..445efce 100644 (file)
@@ -1,9 +1,39 @@
-Vector2.o: Vector2.cpp Vector2.h mathw.h
-ticks.o: ticks.cpp ticks.h
-main.o: main.cpp game.h ticks.h graphics.h
-game.o: game.cpp game.h
 entityManager.o: entityManager.cpp entityManager.h Entities/Entity.h \
   Entities/../Vector2.h Entities/Particle.h Entities/Entity.h \
   Entities/PhysicsEntity.h
-gldraw.o: gldraw.cpp
-graphics.o: graphics.cpp
+game.o: game.cpp game.h GameStates/GameState.h GameStates/Running.h \
+  GameStates/GameState.h GameStates/Paused.h GameStates/CreatingPolygon.h
+main.o: main.cpp debug.h game.h ticks.h graphics/graphics.h \
+  graphics/../Vector2.h input/inputManager.h
+mathw.o: mathw.cpp mathw.h Vector2.h
+ticks.o: ticks.cpp ticks.h
+Vector2.o: Vector2.cpp Vector2.h mathw.h
+Ball.o: Entities/Ball.cpp Entities/Ball.h Entities/PhysicsEntity.h \
+  Entities/Entity.h Entities/../Vector2.h Entities/../graphics/graphics.h \
+  Entities/../graphics/../Vector2.h
+Entity.o: Entities/Entity.cpp Entities/Entity.h Entities/../Vector2.h
+Line.o: Entities/Line.cpp Entities/Line.h Entities/Particle.h \
+  Entities/Entity.h Entities/../Vector2.h
+Particle.o: Entities/Particle.cpp Entities/Particle.h Entities/Entity.h \
+  Entities/../Vector2.h
+PhysicsEntity.o: Entities/PhysicsEntity.cpp Entities/PhysicsEntity.h \
+  Entities/Entity.h Entities/../Vector2.h
+Point.o: Entities/Point.cpp Entities/Point.h Entities/Particle.h \
+  Entities/Entity.h Entities/../Vector2.h
+Polygon.o: Entities/Polygon.cpp Entities/Polygon.h \
+  Entities/PhysicsEntity.h Entities/Entity.h Entities/../Vector2.h
+WindParticle.o: Entities/WindParticle.cpp Entities/WindParticle.h \
+  Entities/Point.h Entities/Particle.h Entities/Entity.h \
+  Entities/../Vector2.h
+CreatingPolygon.o: GameStates/CreatingPolygon.cpp \
+  GameStates/CreatingPolygon.h GameStates/GameState.h
+GameState.o: GameStates/GameState.cpp GameStates/GameState.h
+Paused.o: GameStates/Paused.cpp GameStates/Paused.h \
+  GameStates/GameState.h
+Running.o: GameStates/Running.cpp GameStates/Running.h \
+  GameStates/GameState.h GameStates/../entityManager.h \
+  GameStates/../Entities/Entity.h GameStates/../Entities/../Vector2.h
+inputManager.o: input/inputManager.cpp input/inputManager.h \
+  input/../debug.h
+graphics.o: graphics/graphics.cpp graphics/graphics.h \
+  graphics/../Vector2.h graphics/../debug.h
similarity index 92%
rename from src/graphics.cpp
rename to src/graphics/graphics.cpp
index 0f84d20..a719662 100644 (file)
@@ -5,7 +5,7 @@
 #include <SDL/SDL.h>
 #include <cmath>
 
-#include "debug.h"
+#include "../debug.h"
 
 static const float PI = 3.1415926535897;
 
@@ -27,11 +27,11 @@ void graphicsCleanUp()
 
 }
 
-void glDrawCircle(float radius, float x, float y, const float* color)
+void glDrawCircle(float radius, const Vector2* vec, const float* color)
 {
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
-    glTranslatef(x, y, -1);
+    glTranslatef(vec->x, vec->y, -1);
     glScalef(radius, radius, radius);
 
     if(color != NULL)
similarity index 58%
rename from src/graphics.h
rename to src/graphics/graphics.h
index 43505a6..df3b5c2 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef GRAPHICS_H
 #define GRAPHICS_H
 
+#include "../Vector2.h"
+
 /// ***** Header Methods *****
 void graphicsInit();
 void graphicsCleanUp();
 
-void glDrawCircle(float radius, float x, float y, const float* color = 0);
+void glDrawCircle(float radius, const Vector2*, const float* color = 0);
 
 #endif // GRAPHICS_H
index fd14612..629ca9b 100644 (file)
@@ -9,7 +9,8 @@ using std::vector;
 
 #include "game.h"
 #include "ticks.h"
-#include "graphics.h"
+
+#include "graphics/graphics.h"
 #include "input/inputManager.h"
 
 
@@ -83,6 +84,17 @@ void init()
 #endif
 }
 
+void cleanUp()
+{
+#ifdef DEBUGGING
+    cout << "Cleaning up" << endl;
+#endif
+
+    gameClean();
+
+    graphicsCleanUp();
+}
+
 void run()
 {
     is_Running = true;
@@ -97,11 +109,6 @@ void run()
     }
 }
 
-void cleanUp()
-{
-    gameClean();
-}
-
 void blockUpdate()
 {
     long int start = tickCountMicro();
@@ -142,6 +149,9 @@ void updateFPSCounters()
         draw_Count = 0;
 
         last_Second = tickCountMicro();
+
+        //cout << "ups:\t" << ups << endl;
+        //cout << "fps:\t" << fps << endl;
     }
 }
 
@@ -151,7 +161,7 @@ void input()
 
     gameInput();
 
-    if(isPressed(SDLK_ESCAPE))
+    if(wasReleased(SDLK_ESCAPE))
         is_Running = false;
 }