Created
September 27, 2014 23:42
-
-
Save terryjsmith/85ddecfac0634da4e9d4 to your computer and use it in GitHub Desktop.
Evolution Entity class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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