I am trying to use my class ResourceManagement in my levelmanager, so that I can start creating resources.
however I get the following error(s)
Severity Code Description Project File Line Suppression State Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int levelmanager.h 49
Severity Code Description Project File Line Suppression State Error C2143 syntax error : missing ';' before '*' Diabro levelmanager.h 49
I have declared the ResourceManagement class as followed in the LevelManager.h
private:
Ogre::Entity* _playerEntity;
ResourceManagement* mgr;
and then use it like this in the LevelManager.cpp
mgr->createResource("Diabro\Diabro\media\models", "MESH", "ninja.mesh", "Mesh", "meshes"); //location of file, codeType of resourcetype, name of resource, type of resource, resourcegroup
mgr->loadResource("meshes");
mgr->reloadResource("ninja.mesh", "meshes");
mgr->unloadResource("ninja.mesh", "meshes");
ResourceManagement class
void ResourceManagement::initialize()
{
_groupManager == new Ogre::ResourceGroupManager;
}
void ResourceManagement::createResource(std::string pLocation, std::string pLocType, std::string pResourceName, std::string pResourceType, std::string pGroupName)
{
_groupManager->getSingleton().addResourceLocation(pLocation , pLocType);
_groupManager->getSingleton().declareResource(pResourceName, pResourceType, pGroupName);
_groupManager->getSingleton().initialiseResourceGroup(pGroupName);
// Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); can be used to just load all, need decision which we want
}
void ResourceManagement::unloadResource(std::string pResourceName, std::string pGroupName) // unloads a single resource
{
Ogre::ResourcePtr ptr = _resourceMgr->getResourceByName(pResourceName);
ptr->unload();
_resourceMgr->remove(pResourceName);
}
void ResourceManagement::unloadResourceGoup(std::string pGroupName)
{
_groupManager->getSingleton().unloadResourceGroup(pGroupName);
}
void ResourceManagement::loadResource(std::string pGroupName)
{
_groupManager->getSingleton().loadResourceGroup(pGroupName);
}
void ResourceManagement::reloadResource(std::string pResourceName, std::string pGroupName)
{
Ogre::ResourcePtr ptr = _resourceMgr->load(pResourceName, pGroupName);
ptr->escalateLoading();
ptr->reload();
}