1. #ifndef _IRRLICHTENGINEMANAGER_H__
  2. #define _IRRLICHTENGINEMANAGER_H__
  3.  
  4. #include <irrlicht.h>
  5.  
  6. /**
  7. A handy macro that allows us to access the IrrlichtEngineManager singelton instance
  8. */
  9. #define ENGINEMANAGER IrrlichtEngineManager::Instance()
  10.  
  11. using namespace irr;
  12. using namespace core;
  13. using namespace scene;
  14. using namespace video;
  15. using namespace io;
  16. using namespace gui;
  17.  
  18. /**
  19. IrrlichtEngineManager is used to manage the Irrlicht 3D engine
  20. */
  21. class IrrlichtEngineManager
  22. {
  23. public:
  24. /**
  25. Standard destructor
  26. */
  27. ~IrrlichtEngineManager();
  28. /**
  29. Returns a reference to the singelton object
  30. */
  31. static IrrlichtEngineManager& Instance()
  32. {
  33. static IrrlichtEngineManager instance;
  34. return instance;
  35. }
  36. /**
  37. Initialises the resources needed for the Irrlicht3D engine
  38. */
  39. void Startup();
  40. /**
  41. Cleans up the Irrlicht3D engine resources
  42. */
  43. void Shutdown();
  44. /**
  45. Enters the render loop
  46. */
  47. void StartRenderLoop();
  48. /**
  49. Stops the render loop
  50. */
  51. void EndRenderLoop();
  52. /**
  53. @return The Irrlicht Scene Manager
  54. */
  55. ISceneManager* GetSceneManager() const {return smgr;}
  56. /**
  57. @return The Irrlicht Device
  58. */
  59. IrrlichtDevice* GetIrrlichtDevice() const {return device;}
  60. /**
  61. @return The video driver
  62. */
  63. IVideoDriver* GetVideoDriver() const {return driver;}
  64. /**
  65. @return The GUI Environment
  66. */
  67. IGUIEnvironment* GetGUIEnnvironment() const {return device->getGUIEnvironment();}
  68.  
  69. protected:
  70. /**
  71. Standard constructor
  72. */
  73. IrrlichtEngineManager();
  74. /**
  75. Sets all the member variables to NULL. This is called both by the constructor
  76. and the Shutdown function.
  77. */
  78. void InitialiseVariables();
  79. /// The Irrlicht3D Device
  80. IrrlichtDevice *device;
  81. /// The Irrlicht3D Video Driver
  82. IVideoDriver* driver;
  83. /// The Irrlicht3D Scene Manager
  84. ISceneManager* smgr;
  85. };
  86.  
  87. #endif