QGearsPaletteFile.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. -----------------------------------------------------------------------------
  3. The MIT License (MIT)
  4. Copyright (c) 2013-08-22 Tobias Peters <tobias.peters@kreativeffekt.at>
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. -----------------------------------------------------------------------------
  21. */
  22. #ifndef __QGearsPaletteFile_H__
  23. #define __QGearsPaletteFile_H__
  24. #include <OgreColourValue.h>
  25. #include <OgreResource.h>
  26. #include "common/TypeDefine.h"
  27. namespace QGears
  28. {
  29. class PaletteFile : public Ogre::Resource
  30. {
  31. public:
  32. PaletteFile( Ogre::ResourceManager *creator, const String &name
  33. ,Ogre::ResourceHandle handle, const String &group
  34. ,bool isManual = false, Ogre::ManualResourceLoader *loader = NULL );
  35. virtual ~PaletteFile();
  36. static const String RESOURCE_TYPE;
  37. typedef Ogre::ColourValue Color;
  38. typedef std::vector<Color> Page;
  39. typedef std::vector<Page> PageList;
  40. virtual PageList& getPages( void ) { return m_pages; }
  41. virtual const Page& getPage( size_t index ) const { return m_pages.at(index); }
  42. protected:
  43. virtual void loadImpl();
  44. virtual void unloadImpl();
  45. virtual size_t calculateSize() const;
  46. private:
  47. PageList m_pages;
  48. };
  49. typedef Ogre::SharedPtr<PaletteFile> PaletteFilePtr;
  50. }
  51. #endif // __QGearsPaletteFile_H__