QGearsMapFileManager.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. -----------------------------------------------------------------------------
  3. Copyright (c) 27.10.2013 Tobias Peters <tobias.peters@kreativeffekt.at>
  4. This file is part of Q-Gears
  5. Q-Gears is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, version 2.0 (GPLv2) of the License.
  8. Q-Gears is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. -----------------------------------------------------------------------------
  13. */
  14. #include "map/QGearsMapFileManager.h"
  15. template<> QGears::MapFileManager *Ogre::Singleton<QGears::MapFileManager>::msSingleton = NULL;
  16. namespace QGears
  17. {
  18. //--------------------------------------------------------------------------
  19. MapFileManager *MapFileManager::getSingletonPtr()
  20. {
  21. return msSingleton;
  22. }
  23. //--------------------------------------------------------------------------
  24. MapFileManager &MapFileManager::getSingleton()
  25. {
  26. assert( msSingleton );
  27. return(*msSingleton );
  28. }
  29. //--------------------------------------------------------------------------
  30. MapFileManager::MapFileManager()
  31. {
  32. mResourceType = MapFile::RESOURCE_TYPE;
  33. // low, because it will likely reference other resources
  34. mLoadOrder = 30.0f;
  35. // this is how we register the ResourceManager with OGRE
  36. Ogre::ResourceGroupManager::getSingleton()._registerResourceManager( mResourceType, this );
  37. }
  38. //--------------------------------------------------------------------------
  39. MapFileManager::~MapFileManager()
  40. {
  41. Ogre::ResourceGroupManager::getSingleton()._unregisterResourceManager( mResourceType );
  42. }
  43. //--------------------------------------------------------------------------
  44. Ogre::Resource *MapFileManager::createImpl( const Ogre::String &name
  45. , Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual
  46. , Ogre::ManualResourceLoader *loader
  47. , const Ogre::NameValuePairList *createParams )
  48. {
  49. return new MapFile( this, name, handle, group, isManual, loader );
  50. }
  51. //--------------------------------------------------------------------------
  52. }