BsApplication.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "BsApplication.h"
  2. #include "BsGUIMaterialManager.h"
  3. #include "BsGUIManager.h"
  4. #include "CmApplication.h"
  5. using namespace CamelotEngine;
  6. namespace BansheeEngine
  7. {
  8. Application::Application()
  9. {
  10. }
  11. void Application::startUp(const String& renderSystem, const String& renderer, const String& resourceCacheDir)
  12. {
  13. CM::START_UP_DESC desc;
  14. desc.renderSystem = renderSystem;
  15. desc.renderer= renderer;
  16. desc.resourceCacheDirectory = resourceCacheDir;
  17. desc.input = "CamelotOISInput";
  18. desc.importers.push_back("CamelotFreeImgImporter");
  19. desc.importers.push_back("CamelotFBXImporter");
  20. desc.importers.push_back("CamelotFontImporter");
  21. CM::gApplication().startUp(desc);
  22. GUIManager::startUp(CM_NEW(GUIManager, GenAlloc) GUIManager());
  23. GUIMaterialManager::startUp(CM_NEW(GUIMaterialManager, GenAlloc) GUIMaterialManager());
  24. }
  25. void Application::runMainLoop()
  26. {
  27. CM::gApplication().runMainLoop();
  28. }
  29. void Application::shutDown()
  30. {
  31. GUIMaterialManager::instance().forceReleaseAllMaterials();
  32. CM::gApplication().shutDown();
  33. GUIMaterialManager::shutDown();
  34. GUIManager::shutDown();
  35. }
  36. Application& gBansheeApp()
  37. {
  38. static Application application;
  39. return application;
  40. }
  41. }