From 62f4b61a1dd61d4b1464d0be33e60298cc8cb912 Mon Sep 17 00:00:00 2001 From: lovyan03 <42724151+lovyan03@users.noreply.github.com> Date: Sun, 9 Jul 2023 20:26:56 +0900 Subject: [PATCH] fix compile error --- examples_for_PC/CMake_SDL/LGFX_SDL.cpp | 52 ++++++++++++-------------- src/lgfx/v1/platforms/esp32/common.cpp | 5 ++- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/examples_for_PC/CMake_SDL/LGFX_SDL.cpp b/examples_for_PC/CMake_SDL/LGFX_SDL.cpp index 6f9a0fd8..a9ac27f7 100644 --- a/examples_for_PC/CMake_SDL/LGFX_SDL.cpp +++ b/examples_for_PC/CMake_SDL/LGFX_SDL.cpp @@ -1,29 +1,23 @@ -#include - -#define LGFX_USE_V1 -#include -#include - -void setup(void); -void loop(void); - -static void loopThread(void) -{ - setup(); - for (;;) - { - std::this_thread::yield(); - loop(); - } -} - -int main(int, char**) -{ - std::thread sub_thread(loopThread); - for (;;) - { - std::this_thread::yield(); - lgfx::Panel_sdl::sdl_event_handler(); - SDL_Delay(5); - } -} +#include +#if defined ( SDL_h_ ) + +void setup(void); +void loop(void); + +#if __has_include() +#include +#include +int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +#else +int main(int, char**) +#endif +{ + setup(); + for (;;) + { + lgfx::Panel_sdl::sdl_event_handler(); + loop(); + } + return 1; +} +#endif diff --git a/src/lgfx/v1/platforms/esp32/common.cpp b/src/lgfx/v1/platforms/esp32/common.cpp index 3d9804ef..2296b6d7 100644 --- a/src/lgfx/v1/platforms/esp32/common.cpp +++ b/src/lgfx/v1/platforms/esp32/common.cpp @@ -39,7 +39,6 @@ Original Source: #include #include #include -#include #include @@ -47,6 +46,10 @@ Original Source: #include #endif +#if __has_include () +#include +#endif + #if __has_include () #include #else