EntryPoint.h 1.4 KB

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