-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventCollision.h
47 lines (34 loc) · 1.1 KB
/
EventCollision.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
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __EVENT_COLLISION_H__
#define __EVENT_COLLISION_H__
// game engine includes
#include "Event.h"
#include "Object.h"
namespace df{
// string type
#define DF_COLLISION_EVENT "__collision__"
class EventCollision : public Event {
private:
Position pos; // Where collision occurred.
Object *p_obj1; // Object moving, causing collision.
Object *p_obj2; // Object being collided with.
public:
// Create collision event at (0,0) with obj1 and obj2 NULL.
EventCollision();
// Create collision event between o1 and o2 at position p.
// Object o1 `caused' collision by moving into object o2.
EventCollision(Object *p_o1, Object *p_o2, Position p);
// Return object that caused collision.
Object *getObject1() const;
// Set object that caused collision.
void setObject1(Object *p_new_o1);
// Return object that was collided with.
Object *getObject2() const;
// Set object that was collided with.
void setObject2(Object *p_new_o2);
// Return position of the collision.
Position getPosition() const;
// Set position of collision.
void setPosition(Position new_pos);
};
}
#endif