-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
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
-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
#include <SDL/SDL.h>
#include <cmath>
-#include "debug.h"
+#include "../debug.h"
static const float PI = 3.1415926535897;
}
-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)
#include "game.h"
#include "ticks.h"
-#include "graphics.h"
+
+#include "graphics/graphics.h"
#include "input/inputManager.h"
#endif
}
+void cleanUp()
+{
+#ifdef DEBUGGING
+ cout << "Cleaning up" << endl;
+#endif
+
+ gameClean();
+
+ graphicsCleanUp();
+}
+
void run()
{
is_Running = true;
}
}
-void cleanUp()
-{
- gameClean();
-}
-
void blockUpdate()
{
long int start = tickCountMicro();
draw_Count = 0;
last_Second = tickCountMicro();
+
+ //cout << "ups:\t" << ups << endl;
+ //cout << "fps:\t" << fps << endl;
}
}
gameInput();
- if(isPressed(SDLK_ESCAPE))
+ if(wasReleased(SDLK_ESCAPE))
is_Running = false;
}