1. #include "IrrlichtEngineManager.h"
  2. #include "ConfigurationValues.h"
  3.  
  4. IrrlichtEngineManager::IrrlichtEngineManager()
  5. {
  6. InitialiseVariables();
  7. }
  8.  
  9. IrrlichtEngineManager::~IrrlichtEngineManager()
  10. {
  11.  
  12. }
  13.  
  14. void IrrlichtEngineManager::InitialiseVariables()
  15. {
  16. device = NULL;
  17. driver = NULL;
  18. smgr = NULL;
  19. }
  20.  
  21. void IrrlichtEngineManager::Startup()
  22. {
  23. device = createDevice(VIDEO_RENDERER, dimension2d<u32>(SCREEN_WIDTH, SCREEN_HEIGHT));
  24. // Set the window title
  25. device->setWindowCaption(L"Irrlicht Tutorial");
  26. // get pointers to the video driver and the scene manager for convenience
  27. driver = device->getVideoDriver();
  28. smgr = device->getSceneManager();
  29. }
  30.  
  31. void IrrlichtEngineManager::Shutdown()
  32. {
  33. // any object that was created with a function that starts with "create" needs to be
  34. // deleted with a call to drop
  35. device->drop();
  36. // reset our other variables for consistency
  37. InitialiseVariables();
  38. }
  39.  
  40. void IrrlichtEngineManager::StartRenderLoop()
  41. {
  42. while(device->run())
  43. {
  44. /*
  45. The render loop. Begin the scene, draw the various elements, and then end the scene
  46. */
  47. driver->beginScene(true, true, SColor(SCREEN_CLEAR_COLOUR));
  48.  
  49. smgr->drawAll();
  50.  
  51. driver->endScene();
  52. }
  53. }
  54.  
  55. void IrrlichtEngineManager::EndRenderLoop()
  56. {
  57. // make device->Run() return false
  58. device->closeDevice();
  59. }