EntryPoint.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Jolt/Core/FPException.h>
  5. #if defined(JPH_PLATFORM_WINDOWS)
  6. #define ENTRY_POINT(AppName, RegisterAllocator) \
  7. \
  8. int WINAPI wWinMain(_In_ HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
  9. { \
  10. RegisterAllocator(); \
  11. \
  12. JPH_PROFILE_START("Main"); \
  13. \
  14. FPExceptionsEnable enable_exceptions; \
  15. JPH_UNUSED(enable_exceptions); \
  16. \
  17. { \
  18. AppName app; \
  19. app.Run(); \
  20. } \
  21. \
  22. JPH_PROFILE_END(); \
  23. \
  24. return 0; \
  25. } \
  26. \
  27. int __cdecl main(int inArgC, char **inArgV) \
  28. { \
  29. RegisterAllocator(); \
  30. \
  31. JPH_PROFILE_START("Main"); \
  32. \
  33. FPExceptionsEnable enable_exceptions; \
  34. JPH_UNUSED(enable_exceptions); \
  35. \
  36. { \
  37. AppName app; \
  38. app.Run(); \
  39. } \
  40. \
  41. JPH_PROFILE_END(); \
  42. \
  43. return 0; \
  44. }
  45. #else
  46. #error Undefined
  47. #endif