00001 // ///////////////////////////////////////////////////////////////////////////// 00002 // 00003 // Name: EntityManager.h 00004 // Author: Michael Bartsch (ZCCdark203) 00005 // 00006 // Desc : Declaration of the EntityManager class. 00007 // 00008 // License: Copyright (C) 2009 Michael Bartsch and Contributors 00009 // 00010 // This program is free software: you can redistribute it 00011 // and/or modify it under the terms of the zlib/libpng License. 00012 // See main.cpp for conditions of distribution and use. 00013 // 00014 // ///////////////////////////////////////////////////////////////////////////// 00015 00016 #ifndef __ENTITYMANAGER_H__ 00017 #define __ENTITYMANAGER_H__ 00018 00019 // Include files 00020 #include "../dependencies.h" 00021 #include "Entity.h" 00022 00023 // Forward declarations 00024 class Entity; 00025 00026 00027 // EntityManager class 00030 class EntityManager 00031 { 00032 public: 00033 00034 // Initialisation and deinitialisation 00036 EntityManager(); 00038 ~EntityManager(); 00039 00041 void init(); 00043 void clear(); 00044 00045 // AngelScript binding 00048 void refAdd(); 00051 void refRelease(); 00052 00053 // Methods 00057 bool addEntity(Entity *entity); 00062 Entity* createEntity(const std::string &name, Entity *parent = NULL); 00063 00066 Entity* getEntity(const u32 id); 00069 Entity* getEntity(const std::string &name); 00070 00072 void removeAllEntities(); 00076 bool removeEntity(Entity *entity); 00080 bool removeEntity(const u32 id); 00084 bool removeEntity(const std::string &name); 00085 00086 private: 00087 00088 // Private members 00089 vector<Entity*> mEntities; 00090 }; 00091 00092 00093 // EntityManager Angelscript binding. 00095 extern void bindEntityManager(asIScriptEngine *engine); 00096 00097 #endif