{
public:
Gravity();
- virtual ~Gravity();
+ ~Gravity();
Vector2 positionDelta(const PhysicsEntity*, float) const;
Vector2 velocityDelta(const PhysicsEntity*, float) const;
--- /dev/null
+#include "Screen.h"
+#include "../debug.h"
+
+#include "../Entities/PhysicsEntity.h"
+
+Screen::Screen()
+{
+
+}
+Screen::~Screen()
+{
+
+}
+
+Vector2 Screen::positionDelta(const PhysicsEntity*, float) const
+{
+ return Vector2(0,0);
+}
+
+Vector2 Screen::velocityDelta(const PhysicsEntity* e, float time_step) const
+{
+ const Vector2& pos = e->positionRaw();
+ const Vector2& velo = e->velocityRaw();
+
+ Vector2 acc(0,0);
+
+ if(pos.y > 600 && velo.y > 0)
+ {
+ acc.y += velo.y * -2;
+ }
+
+ if(pos.y < 0 && velo.y < 0)
+ {
+ acc.y += velo.y * -2;
+ }
+
+ if(pos.x > 800 && velo.x > 0)
+ {
+ acc.x += velo.x * -2;
+ }
+
+ if(pos.x < 0 && velo.x < 0)
+ {
+ acc.x += velo.x * -2;
+ }
+
+ return acc;
+}
+
+Vector2 Screen::forceDelta(const PhysicsEntity*, float) const
+{
+ return Vector2(0,0);
+}
--- /dev/null
+#ifndef SCREEN_H
+#define SCREEN_H
+
+#include "../Vector2.h"
+#include "Effect.h"
+
+/// ***** Header Class *****
+class Screen: public Effect
+{
+ public:
+ Screen();
+ ~Screen();
+
+ Vector2 positionDelta(const PhysicsEntity*, float) const;
+ Vector2 velocityDelta(const PhysicsEntity*, float) const;
+ Vector2 forceDelta(const PhysicsEntity*, float) const;
+};
+
+#endif // SCREEN_H
/// ***** Public Class Methods *****
+const Vector2& Entity::positionRaw() const
+{
+ return position;
+}
+const Vector2& Entity::velocityRaw() const
+{
+ return velocity;
+}
+
Entity::Entity(const Vector2& pos)
: position(pos), velocity(0,0)
{
virtual void update(float) = 0;
virtual void draw() const = 0;
+ const Vector2& positionRaw() const;
+ const Vector2& velocityRaw() const;
+
protected:
Vector2 position;
Vector2 velocity;
SRCS += Effects/Effect.cpp
SRCS += Effects/Gravity.cpp
+SRCS += Effects/Screen.cpp
SRCS += input/inputManager.cpp
#include "Effects/Effect.h"
#include "Effects/Gravity.h"
+#include "Effects/Screen.h"
/// ***** Private Variables *****
Effect** effects;
void effect::init()
{
- numEffects = 1;
+ numEffects = 2;
effects = new Effect*[numEffects]();
effects[0] = new Gravity();
+ effects[1] = new Screen();
}
void effect::clean()
{
void manager::init()
{
+
}
void manager::clean()
{
+
}
void manager::add(Entity* e)