Skip to content

Instantly share code, notes, and snippets.

@terryjsmith
Created September 27, 2014 23:42
Show Gist options
  • Save terryjsmith/85ddecfac0634da4e9d4 to your computer and use it in GitHub Desktop.
Save terryjsmith/85ddecfac0634da4e9d4 to your computer and use it in GitHub Desktop.
Evolution Entity class
class Entity {
public:
Entity();
~Entity();
public:
void AddComponent(Component* component);
template<class T>
Component* GetComponent() {
Component* current = m_components;
while(current) {
if(dynamic_cast<T>(current) != NULL) {
return(current);
}
current = current->next;
}
return(0);
}
public:
Component* m_components;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment