struct IEntityClassRegistry { struct SEntityClassDesc { int flags; const char* sName; const char* sScriptFile; SEditorClassInfo editorClassInfo; IEntityClass::UserProxyCreateFunc pUserProxyCreateFunc; void* pUserProxyData; IEntityPropertyHandler* pPropertyHandler; IEntityEventHandler* pEventHandler; IEntityScriptFileHandler* pScriptFileHandler; }; };
IEntityClass.h
This interface is the repository of the the various entity classes, it allows creation and modification of entities types. There`s only one IEntityClassRegistry interface can exist per EntitySystem. Every entity class that can be spawned must be registered in this interface.
struct SEntityClassDesc { int flags; const char* sName; const char* sScriptFile; SEditorClassInfo editorClassInfo; IEntityClass::UserProxyCreateFunc pUserProxyCreateFunc; void* pUserProxyData; IEntityPropertyHandler* pPropertyHandler; IEntityEventHandler* pEventHandler; IEntityScriptFileHandler* pScriptFileHandler; };
IEntityClass.h
SEditorClassInfo editorClassInfo;
int flags;
IEntityEventHandler* pEventHandler;
IEntityPropertyHandler* pPropertyHandler;
IEntityScriptFileHandler* pScriptFileHandler;
IEntityClass::UserProxyCreateFunc pUserProxyCreateFunc;
void* pUserProxyData;
const char* sName;
const char* sScriptFile;
SEntityClassDesc();
virtual ~IEntityClassRegistry();
virtual IEntityClass* FindClass(const char * sClassName) const = 0;
Pointer to the IEntityClass interface, or NULL if class not found.
Retrieves pointer to the IEntityClass interface by entity class name.
virtual int GetClassCount() const = 0;
Return a pointer to the next IEntityClass interface, or NULL if is the end
Return the number of entity classes in the registry.
virtual IEntityClass* GetDefaultClass() const = 0;
Pointer to the IEntityClass interface, It can never return NULL.
Retrieves pointer to the IEntityClass interface for a default entity class.
virtual void IteratorMoveFirst() = 0;
Move the entity class iterator to the begin of the registry. To iterate over all entity classes, ex: ... IEntityClass *pClass = NULL; for (pEntityRegistry->IteratorMoveFirst(); pClass = pEntityRegistry->IteratorNext();;) { pClass ...
virtual IEntityClass* IteratorNext() = 0;
Return a pointer to the next IEntityClass interface, or NULL if is the end
Get the next entity class in the registry.
virtual void LoadClasses(const char * sPath, bool bOnlyNewClasses = false) = 0;
Parameters |
Description |
const char * sPath |
Path where to search for .ent files. |
Load all entity class description xml files with extension ".ent" from specified directory.
virtual bool RegisterClass(IEntityClass * pClass) = 0;
true if successfully registered.
Register a new entity class.
virtual IEntityClass* RegisterStdClass(const SEntityClassDesc & entityClassDesc) = 0;
Pointer to the new created and registered IEntityClass interface, or NULL if failed.
Register standard entity class, if class id not specified (is zero), generate a new class id.
virtual bool UnregisterClass(IEntityClass * pClass) = 0;
true if successfully unregistered.
Unregister an entity class.