Game Engine Framework? :: Resource Manager
The ResourceManager maintains the extension-point entries for "!IndieZen::!ResourceManager::ResourceService". It can also be used as a class factory for I_ResourceServices.
Example Code Snippet
This code snippet was taken from the MMORPG Base Client implementation found here.
It can be used as an example of how to get a specific resource service by name.
Currently reserved names are:
- ogre - ResourceService required by the Ogre rendering library
- torque - ResourceService required by the Torque Game Engine
- nvidia - ResourceService required by the NVidia SDK
- team - Resource Service required by IndieZen Game Studio for replicating resource modifications.
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void BaseClient::initResourceService() { // TODO Don't hard-code this std::string resourceServiceType("ogre"); m_pResourceService = ResourceManager::I_ResourceManager.instance().getService(resourceServiceType); }
Extension Point Definition
<?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by IndieZen C++ PDE --> <schema targetNamespace="IndieZen::ResourceManager"> <annotation> <appInfo> <meta.schema plugin="Framework" id="ResourceService" name="Resource Service"/> </appInfo> <documentation> For providing an implementation of a IndieZen::ResourceManager::I_ResourceService </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="resource-service" minOccurs="1" maxOccurs="1"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> A fully qualified identifier of the target extension-point. </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> An optional identifier of the extension instance. </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> An optional name of the extension instance. </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="resource-service"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> The fully qualified name of a class which implements IndieZen::ResourceManager::I_ResourceService. </documentation> <appInfo> <meta.attribute kinda="cpp" basedOn="IndieZen::ResourceManager::I_ResourceService"/> </appInfo> </annotation> </attribute> <attribute name="type" type="string" use="required"> <annotation> <documentation> The type of resource service. </documentation> </annotation> </attribute> </complexType> </element> </schema>
