TextManager.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef TEXT_MANAGER_H
  2. #define TEXT_MANAGER_H
  3. #include <OgreString.h>
  4. #include <OgreSingleton.h>
  5. #include <tinyxml.h>
  6. class TextManager : public Ogre::Singleton< TextManager >
  7. {
  8. public:
  9. TextManager();
  10. virtual ~TextManager();
  11. void InitCmd();
  12. void SetLanguage( const Ogre::String& language );
  13. const Ogre::String& GetLanguage();
  14. void AddText( const Ogre::String& name, TiXmlNode* node );
  15. void AddDialog( const Ogre::String& name, TiXmlNode* node, const float width, const float height );
  16. TiXmlNode* GetText( const Ogre::String& name ) const;
  17. TiXmlNode* GetDialog( const Ogre::String& name, float &width, float& height ) const;
  18. void UnloadTexts();
  19. private:
  20. Ogre::String m_Language;
  21. struct Text
  22. {
  23. Ogre::String name;
  24. TiXmlNode* node;
  25. };
  26. std::vector< Text > m_Texts;
  27. struct Dialog
  28. {
  29. Ogre::String name;
  30. TiXmlNode* node;
  31. float width;
  32. float height;
  33. };
  34. std::vector< Dialog > m_Dialogs;
  35. };
  36. #endif // TEXT_MANAGER_H