VGearsAFileManager.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include "data/VGearsAFileManager.h"
  16. /**
  17. * '.A' File manager singleton.
  18. */
  19. template<> VGears::AFileManager *Ogre::Singleton<VGears::AFileManager>::msSingleton = nullptr;
  20. namespace VGears{
  21. AFileManager *AFileManager::GetSingletonPtr(){return msSingleton;}
  22. AFileManager &AFileManager::GetSingleton(){
  23. assert( msSingleton );
  24. return(*msSingleton );
  25. }
  26. AFileManager::AFileManager(){
  27. mResourceType = AFile::RESOURCE_TYPE;
  28. // Low, because it will likely reference other resources:
  29. mLoadOrder = 30.0f;
  30. // This is how the ResourceManager registers with OGRE.
  31. Ogre::ResourceGroupManager::getSingleton()._registerResourceManager(mResourceType, this);
  32. }
  33. AFileManager::~AFileManager(){
  34. Ogre::ResourceGroupManager::getSingleton()._unregisterResourceManager(mResourceType);
  35. }
  36. Ogre::Resource *AFileManager::createImpl(
  37. const Ogre::String &name, Ogre::ResourceHandle handle,
  38. const Ogre::String &group, bool is_manual,
  39. Ogre::ManualResourceLoader *loader,
  40. const Ogre::NameValuePairList *create_params
  41. ){
  42. return new AFile(this, name, handle, group, is_manual, loader);
  43. }
  44. }