EntryPoint.h 1.7 KB

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