From: Patrik Gornicz Date: Fri, 1 Aug 2008 21:31:41 +0000 (-0400) Subject: Effects changed to delta system X-Git-Tag: physics-premerge~180 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=ec70635e518dbd916303ec7d5ffa5e9b99bde565;p=libbear.git Effects changed to delta system --- diff --git a/src/Effects/Effect.cpp b/src/Effects/Effect.cpp new file mode 100644 index 0000000..8ea3880 --- /dev/null +++ b/src/Effects/Effect.cpp @@ -0,0 +1,11 @@ +#include "Effect.h" + +Effect::Effect() +{ + +} + +Effect::~Effect() +{ + +} diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h index 75d349a..58c8afa 100644 --- a/src/Effects/Effect.h +++ b/src/Effects/Effect.h @@ -1,12 +1,21 @@ #ifndef EFFECT_H #define EFFECT_H +#include "../Vector2.h" +#include "../Entities/PhysicsEntity.h" + /// ***** Header Class ***** class Effect { + protected: + Effect(); + public: - virtual Vector2 positionAfter(const Vector&, float) const = 0; - virtual Vector2 velocityAfter(const Vector&, float) const = 0; -} + virtual ~Effect(); + + virtual Vector2 positionDelta(const PhysicsEntity*, float) const = 0; + virtual Vector2 velocityDelta(const PhysicsEntity*, float) const = 0; + virtual Vector2 forceDelta(const PhysicsEntity*, float) const = 0; +}; #endif // EFFECT_H diff --git a/src/Effects/Gravity.cpp b/src/Effects/Gravity.cpp index 3d2cd0a..d7852d3 100644 --- a/src/Effects/Gravity.cpp +++ b/src/Effects/Gravity.cpp @@ -1,13 +1,25 @@ #include "Gravity.h" -/// ***** Header Class ***** -Vector2 Gravity::positionAfter(const Vector2&, float) +Gravity::Gravity() { } -Vector2 Gravity::velocityAfter(const Vector2&, float) +Gravity::~Gravity() { } -#endif // GRAVITY_H +Vector2 Gravity::positionDelta(const PhysicsEntity*, float) +{ + return Vector2(0, 0); +} + +Vector2 Gravity::velocityDelta(const PhysicsEntity*, float) +{ + return Vector2(0, 0); +} + +Vector2 Gravity::forceDelta(const PhysicsEntity*, float) +{ + return Vector2(0, 0.000001); +} diff --git a/src/Effects/Gravity.h b/src/Effects/Gravity.h index 4281194..f6dd459 100644 --- a/src/Effects/Gravity.h +++ b/src/Effects/Gravity.h @@ -1,13 +1,19 @@ #ifndef GRAVITY_H #define GRAVITY_H +#include "../Vector2.h" #include "Effect.h" /// ***** Header Class ***** class Gravity: public Effect { - Vector2 positionAfter(const Vector2&, float); - Vector2 velocityAfter(const Vector2&, float); -} + public: + Gravity(); + ~Gravity(); + + Vector2 positionDelta(const PhysicsEntity*, float); + Vector2 velocityDelta(const PhysicsEntity*, float); + Vector2 forceDelta(const PhysicsEntity*, float); +}; #endif // GRAVITY_H diff --git a/src/Makefile b/src/Makefile index 32cfc49..b7fcb11 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,6 +36,9 @@ SRCS += GameStates/GameState.cpp SRCS += GameStates/Paused.cpp SRCS += GameStates/Running.cpp +SRCS += Effects/Effect.cpp +SRCS += Effects/Gravity.cpp + SRCS += input/inputManager.cpp SRCS += graphics/graphics.cpp @@ -46,6 +49,7 @@ DEPENDS := ${SRCS:.cpp=.d} HRDS := ${SRCS:.cpp=.h} HRDS := ${HRDS:main.h=} # remove main.h HRDS += debug.h + HRDS += graphics/colors.h TARS := ${SRCS} ${HRDS} Makefile