Main.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "BsApplication.h"
  2. #include "BsCrashHandler.h"
  3. #include "BsCoreThread.h"
  4. #if BS_PLATFORM == BS_PLATFORM_WIN32
  5. #include <windows.h>
  6. using namespace BansheeEngine;
  7. int CALLBACK WinMain(
  8. _In_ HINSTANCE hInstance,
  9. _In_ HINSTANCE hPrevInstance,
  10. _In_ LPSTR lpCmdLine,
  11. _In_ int nCmdShow
  12. )
  13. {
  14. CrashHandler::startUp();
  15. __try
  16. {
  17. RENDER_WINDOW_DESC renderWindowDesc;
  18. renderWindowDesc.videoMode = VideoMode(200, 200); // TODO - Get desktop resolution
  19. renderWindowDesc.title = "Banshee Game"; // TODO - Get this from game settings
  20. renderWindowDesc.fullscreen = false; // TODO - Get this from game settings
  21. renderWindowDesc.hideUntilSwap = true;
  22. RenderAPIPlugin renderAPI = RenderAPIPlugin::DX11; // TODO - Get this from game settings
  23. Application::startUp(renderWindowDesc, renderAPI);
  24. // TODO - If on first run start in fullscreen (perhaps Build settings controlled) at desktop resolution
  25. const VideoModeInfo& videoModeInfo = RenderAPI::getVideoModeInfo();
  26. const VideoOutputInfo& primaryMonitorInfo = videoModeInfo.getOutputInfo(0);
  27. const VideoMode& selectedVideoMode = primaryMonitorInfo.getDesktopVideoMode();
  28. RenderWindowPtr window = gApplication().getPrimaryWindow();
  29. window->setFullscreen(gCoreAccessor(), selectedVideoMode);
  30. // TODO - Load main scene
  31. Application::instance().runMainLoop();
  32. Application::shutDown();
  33. }
  34. __except (gCrashHandler().reportCrash(GetExceptionInformation()))
  35. {
  36. PlatformUtility::terminate(true);
  37. }
  38. CrashHandler::shutDown();
  39. return 0;
  40. }
  41. #endif // End BS_PLATFORM