4 * Created on: Apr 9, 2012
11 #include "../geometry/Shape.h"
12 #include "../geometry/Vector2D.h"
24 typedef geometry::Shape::Scalar Scalar;
25 typedef geometry::Shape::Vector Vector;
26 typedef geometry::Shape::Limits Limits;
29 explicit Entity(geometry::Shape *);
30 Entity(const Vector &position, geometry::Shape *);
31 virtual ~Entity(void);
34 void Move(const Vector &d);
36 void SetPosition(const Vector &);
39 const Vector &Position(void) const { return position; };
40 Vector Center(void) const;
41 const Vector &Velocity() const { return velocity; };
42 void SetVelocity(const Vector &);
45 const geometry::Shape &Bounds(void) const { return *bounds; };
46 bool Overlaps(const Entity &other, Vector &normal) {
47 return bounds->Overlaps(*other.bounds, normal);
51 void Update(float deltaT);
52 void Revert(float deltaT);
53 virtual void Collide(Entity &, const Vector &normal);
54 virtual void PostCollide(void);
55 virtual void Render(SDL_Surface *dest) { };
58 bool IsDynamic(void) const { return dynamic; };
59 bool IsStatic(void) const { return !dynamic; };
60 void SetDynamic(void) { dynamic = true; };
61 void SetStatic(void) { dynamic = false; };
64 void Accelerate(float factor);
65 void SetMaxVelocity(float);
68 geometry::Shape *bounds;
69 Vector position, velocity, nextVelocity;
70 Scalar maxVelocitySquared;
71 bool dynamic, updateVelocity;
76 #endif /* GAME_ENTITY_H_ */