VGearsPaletteFileManager.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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/VGearsPaletteFileManager.h"
  16. /**
  17. * Palette file manager singleton.
  18. */
  19. template<> VGears::PaletteFileManager
  20. *Ogre::Singleton<VGears::PaletteFileManager>::msSingleton = nullptr;
  21. namespace VGears{
  22. PaletteFileManager *PaletteFileManager::GetSingletonPtr(){
  23. return msSingleton;
  24. }
  25. PaletteFileManager &PaletteFileManager::GetSingleton(){
  26. assert( msSingleton );
  27. return(*msSingleton );
  28. }
  29. PaletteFileManager::PaletteFileManager(){
  30. mResourceType = PaletteFile::RESOURCE_TYPE;
  31. // Low, because it will likely reference other resources.
  32. mLoadOrder = 30.0f;
  33. // This is how the ResourceManager registers with OGRE.
  34. Ogre::ResourceGroupManager::getSingleton()._registerResourceManager(
  35. mResourceType, this
  36. );
  37. }
  38. PaletteFileManager::~PaletteFileManager(){
  39. Ogre::ResourceGroupManager::getSingleton()._unregisterResourceManager(
  40. mResourceType
  41. );
  42. }
  43. Ogre::Resource *PaletteFileManager::createImpl(
  44. const Ogre::String &name, Ogre::ResourceHandle handle,
  45. const Ogre::String& group, bool is_manual,
  46. Ogre::ManualResourceLoader* loader,
  47. const Ogre::NameValuePairList* createParams
  48. ){
  49. return new PaletteFile(this, name, handle, group, is_manual, loader);
  50. }
  51. }