-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponent.h
More file actions
62 lines (44 loc) · 1011 Bytes
/
Component.h
File metadata and controls
62 lines (44 loc) · 1011 Bytes
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef COMPONENT_H
#define COMPONENT_H
#include "ComponentType.h"
#include <iostream>
enum ComponentState {
ALIVE,
INACTIVE,
DEAD
};
class Component
{
protected:
class Buffer
{
public:
void resetBuffer() { }
};
Component* getComponent(ComponentType type);
private:
// Type of the Component
ComponentType type;
// Status - do we continue maintaining it?
ComponentState state;
// Pool the next updates
Buffer* buffer;
int parentObjectID;
public:
Component (ComponentType type);
~Component ();
// For accessing other components of the same object
ComponentType getType();
void setParentObjectID(int newID);
// State related
ComponentState getState();
void deactivate();
void kill();
// Register component to be alerted to events
// Once registered, events come in through this
// Update function in behavior
virtual void update(float dt) = 0;
// Specify how the buffer is made
virtual void applyBuffer() = 0;
};
#endif