-
Notifications
You must be signed in to change notification settings - Fork 1
/
collisionStrategy.h
34 lines (30 loc) · 926 Bytes
/
collisionStrategy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef COLLISION_STRATEGY
#define COLLISION_STRATEGY
#include <cmath>
#include "sprite.h"
class CollisionStrategy {
public:
virtual bool execute(const Drawable&, const Drawable&) const = 0;
virtual void draw() const = 0;
virtual ~CollisionStrategy() {}
};
class RectangularCollisionStrategy : public CollisionStrategy {
public:
RectangularCollisionStrategy() {}
virtual bool execute(const Drawable&, const Drawable&) const;
virtual void draw() const;
};
class MidPointCollisionStrategy : public CollisionStrategy {
public:
MidPointCollisionStrategy() {}
virtual bool execute(const Drawable&, const Drawable&) const;
virtual void draw() const;
float distance(float, float, float, float) const;
};
class PerPixelCollisionStrategy : public CollisionStrategy {
public:
PerPixelCollisionStrategy() {}
virtual bool execute(const Drawable&, const Drawable&) const;
virtual void draw() const;
};
#endif