QGearsApplication.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. -----------------------------------------------------------------------------
  3. Copyright (c) 19.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. #ifndef __QGearsApplication_H__
  15. #define __QGearsApplication_H__
  16. #include <OgreRoot.h>
  17. #include <Overlay/OgreOverlaySystem.h>
  18. #include "TypeDefine.h"
  19. namespace QGears
  20. {
  21. class Application : public Ogre::Singleton<Application>
  22. {
  23. public:
  24. Application( int argc, char *argv[] );
  25. virtual ~Application();
  26. bool initOgre( void );
  27. Ogre::Root* getRoot( void );
  28. Ogre::RenderWindow* getRenderWindow( void );
  29. const String& getResourcesFilename( void );
  30. protected:
  31. String getWindowTitle( void ) const;
  32. bool processCommandLine( int argc, char *argv[] );
  33. void registerArchiveFactories( void );
  34. void loadResourcesConfig( void );
  35. void initComponents( void );
  36. void destroyComponents( void );
  37. void createResourceManagers( void );
  38. void destroyResourceManagers( void );
  39. private:
  40. typedef std::vector<std::shared_ptr<Ogre::ResourceManager>> ResourceManagerVector;
  41. Application();
  42. static const char* CLI_SECTION_GENERIC;
  43. static const char* CLI_HELP;
  44. static const char* CLI_HELP_DESCRIPTION;
  45. static const char* CLI_CONFIG_FILE;
  46. static const char* CLI_CONFIG_FILE_DESCRIPTION;
  47. static const char* CLI_LOG_FILE;
  48. static const char* CLI_LOG_FILE_DESCRIPTION;
  49. static const char* CLI_PLUGINS_FILE;
  50. static const char* CLI_PLUGINS_FILE_DESCRIPTION;
  51. static const char* CLI_RESOURCES_FILE;
  52. static const char* CLI_RESOURCES_FILE_DESCRIPTION;
  53. int m_argc = 0;
  54. char **m_argv = nullptr;
  55. String m_config_filename;
  56. String m_log_filename;
  57. String m_plugins_filename;
  58. String m_resources_filename;
  59. bool m_initialized = false;
  60. std::unique_ptr<Ogre::Root> m_root;
  61. std::unique_ptr<Ogre::OverlaySystem> m_overlay_system;
  62. Ogre::RenderWindow* m_render_window = nullptr; // Not owned
  63. ResourceManagerVector m_resource_managers;
  64. };
  65. }
  66. #endif // __QGearsApplication_H__