-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponentFactory.h
More file actions
47 lines (28 loc) · 771 Bytes
/
ComponentFactory.h
File metadata and controls
47 lines (28 loc) · 771 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
#ifndef COMPONENTFACTORY_H
#define COMPONENTFACTORY_H
#include "stdafx.h"
#include <vector>
//#include "Component.h"
class Component;
class ComponentFactory {
public:
~ComponentFactory();
typedef std::vector<Component*> ComponentList;
template <class T>
T* create() {
T* c = new T();
m_xComponents[c->getType()].push_back(c);
return c;
}
void destroy(Component* component);
//void update(Component::Type type, float delta, float elapsedTime);
const ComponentList* getList(unsigned int type);
static ComponentFactory* instance();
private:
ComponentFactory();
ComponentFactory(const ComponentFactory&);
static ComponentFactory s_xInstance;
//ComponentList m_xComponents[Component::TYPE_N];
ComponentList* m_xComponents;
};
#endif