我正在尝试在我的关卡管理器中使用我的类ResourceManagement,以便我可以开始创建资源。
然而我收到以下错误
严重级代码描述项目文件行抑制状态 错误C4430缺少类型说明符 - 假定为int。注意:C ++没有 支持default-int levelmanager.h 49
严重级代码描述项目文件行抑制状态 错误C2143语法错误:缺少&#39 ;;'之前 ' *' Diabro levelmanager.h 49
我在LevelManager.h
中声明了ResourceManagement类private:
Ogre::Entity* _playerEntity;
ResourceManagement* mgr;
然后在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类
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();
}