From 7934df34ef9598b54e34618530e9e91f91ec27d0 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 9 Sep 2014 12:01:43 +0000 Subject: [PATCH] build: "USE_SDL" is now for SDL v2 and "USE_OLD_SDL" for version 1. --- build/autotools/m4/lol-sdl.m4 | 115 ++++++++++++++++--------- build/visualstudio/Lol.Core.Vars.props | 2 +- src/application/application.cpp | 4 +- src/eglapp.cpp | 10 ++- src/gpu/renderer.cpp | 2 +- src/lol/engine-internal.h | 2 +- src/lol/engine.h | 2 +- src/platform/sdl/sdlapp.cpp | 35 ++++---- src/platform/sdl/sdlinput.cpp | 52 +++++------ 9 files changed, 133 insertions(+), 91 deletions(-) diff --git a/build/autotools/m4/lol-sdl.m4 b/build/autotools/m4/lol-sdl.m4 index e33b9ca7..d859ef98 100644 --- a/build/autotools/m4/lol-sdl.m4 +++ b/build/autotools/m4/lol-sdl.m4 @@ -6,13 +6,16 @@ AC_DEFUN([LOL_CHECK_SDL], dnl Find which version of SDL to use (always required on Linux or Win32) dnl dnl Defined C/C++ macros: -dnl USE_SDL -- whether SDL or SDL2 were found at all -dnl USE_SDL_IMAGE -- whether SDL_image was found -dnl USE_SDL_MIXER -- whether SDL_mixer was found -dnl HAVE_SDL_SDL_H -- whether to include +dnl USE_SDL -- whether SDL v2 was found +dnl USE_OLD_SDL -- whether SDL v1 was found +dnl USE_SDL_IMAGE -- whether SDL_image (v1 or v2) was found +dnl USE_SDL_MIXER -- whether SDL_mixer (v1 or v2) was found dnl HAVE_SDL_H -- whether to include +dnl HAVE_SDL_SDL_H -- whether to include +dnl HAVE_SDL2_SDL_H -- whether to include dnl Generated automake conditionals: -dnl USE_SDL -- whether SDL or SDL2 were found at all +dnl USE_SDL -- whether SDL v2 was found +dnl USE_OLD_SDL -- whether SDL v1 was found dnl USE_SDL_IMAGE -- whether SDL_image was found dnl USE_SDL_MIXER -- whether SDL_mixer was found dnl Generated shell variables: @@ -20,15 +23,16 @@ dnl SDL_CFLAGS -- flags for SDL compilation dnl SDL_LIBS -- flags for SDL linking ac_cv_my_have_sdl="no" -ac_cv_my_have_sdl2="no" +ac_cv_my_have_old_sdl="no" ac_cv_my_have_sdl_image="no" ac_cv_my_have_sdl_mixer="no" + dnl First, try the proper pkg-config check for SDL2 + if test "x${ac_cv_my_have_sdl}" = xno; then PKG_CHECK_MODULES(SDL2, sdl2, [ac_cv_my_have_sdl="yes" - ac_cv_my_have_sdl2="yes" PKG_CHECK_MODULES(SDL2MIXER, SDL2_mixer, [ac_cv_my_have_sdl_mixer="yes" AC_DEFINE(HAVE_SDL_MIXER_H, 1, Define to 1 to use SDL_mixer.h)], @@ -43,10 +47,45 @@ if test "x${ac_cv_my_have_sdl}" = xno; then [:]) fi -dnl Then, try the proper pkg-config check for SDL 1.x + +dnl Maybe all this has failed, try direct inclusion instead + if test "x${ac_cv_my_have_sdl}" = xno; then + save_CPPFLAGS="${CPPFLAGS}" + save_LIBS="${LIBS}" + CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" + LIBS="${LIBS} ${SDL_LIBS}" + AC_CHECK_HEADERS(SDL.h SDL/SDL.h SDL2/SDL.h, [ac_cv_my_have_sdl="yes"]) + if test "x${ac_cv_my_have_sdl}" != xno; then + AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h SDL2/SDL_mixer.h, + [ac_cv_my_have_sdl_mixer="yes"]) + AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h SDL2/SDL_image.h, + [ac_cv_my_have_sdl_image="yes"]) + AC_CHECK_LIB(SDL2, main, + [SDL_LIBS="${SDL_LIBS} -lSDL2"], + [ac_cv_my_have_sdl="no"]) + AC_CHECK_LIB(SDL2main, main, + [SDL_LIBS="${SDL_LIBS} -lSDL2main -lSDL2"]) + AC_CHECK_LIB(SDL2_mixer, main, + [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL2_mixer"], + [ac_cv_my_have_sdl_mixer="no"]) + AC_CHECK_LIB(SDL2_image, main, + [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL2_image"], + [ac_cv_my_have_sdl_image="no"]) + fi + SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}" + SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}" + CPPFLAGS="${save_CPPFLAGS}" + LIBS="${save_LIBS}" +fi + + +dnl Then, try the proper pkg-config check for SDL 1.x + +if test "x${ac_cv_my_have_sdl}" = xno \ + -a "x${ac_cv_my_have_old_sdl}" = xno; then PKG_CHECK_MODULES(SDL, sdl, - [ac_cv_my_have_sdl="yes" + [ac_cv_my_have_old_sdl="yes" PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes" AC_DEFINE(HAVE_SDL_MIXER_H, 1, Define to 1 to use SDL_mixer.h)], @@ -61,51 +100,47 @@ if test "x${ac_cv_my_have_sdl}" = xno; then [:]) fi + dnl Then the old sdl-config method -if test "x${cross_compiling}" != xyes -a "x${ac_cv_my_have_sdl}" = xno; then + +if test "x${ac_cv_my_have_sdl}" = xno \ + -a "x${ac_cv_my_have_old_sdl}" = xno \ + -a "x${cross_compiling}" != xyes; then AC_PATH_PROG(SDL_CONFIG, sdl-config, no) if test "${SDL_CONFIG}" != "no" && "${SDL_CONFIG}" --version >/dev/null; then - ac_cv_my_have_sdl="yes" + ac_cv_my_have_old_sdl="yes" SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`" SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`" AC_DEFINE(HAVE_SDL_H, 1, Define to 1 to use SDL.h) fi fi -dnl Maybe all this has failed, try direct inclusion instead -if test "x${ac_cv_my_have_sdl}" = xno; then + +dnl Finally, try direct inclusion + +if test "x${ac_cv_my_have_sdl}" = xno \ + -a "x${ac_cv_my_have_old_sdl}" = xno; then save_CPPFLAGS="${CPPFLAGS}" save_LIBS="${LIBS}" CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" LIBS="${LIBS} ${SDL_LIBS}" - AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"]) - if test "x${ac_cv_my_have_sdl}" != xno; then - AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"]) - AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h, [ac_cv_my_have_sdl_image="yes"]) - + AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_old_sdl="yes"]) + if test "x${ac_cv_my_have_old_sdl}" != xno; then + AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h, + [ac_cv_my_have_sdl_mixer="yes"]) + AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h, + [ac_cv_my_have_sdl_image="yes"]) AC_CHECK_LIB(SDL, main, [SDL_LIBS="${SDL_LIBS} -lSDL"], - [AC_CHECK_LIB(SDL2, main, - [SDL_LIBS="${SDL_LIBS} -lSDL2" - ac_cv_my_have_sdl2="yes"], - [ac_cv_my_have_sdl="no"])]) - + [ac_cv_my_have_old_sdl="no"]) AC_CHECK_LIB(SDLmain, main, [SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"]) - AC_CHECK_LIB(SDL2main, main, - [SDL_LIBS="${SDL_LIBS} -lSDL2main -lSDL2"]) - AC_CHECK_LIB(SDL_mixer, main, [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"], - [AC_CHECK_LIB(SDL2_mixer, main, - [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL2_mixer"], - [ac_cv_my_have_sdl_mixer="no"])]) - + [ac_cv_my_have_sdl_mixer="no"]) AC_CHECK_LIB(SDL_image, main, [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"], - [AC_CHECK_LIB(SDL2_image, main, - [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL2_image"], - [ac_cv_my_have_sdl_image="no"])]) + [ac_cv_my_have_sdl_image="no"]) fi SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}" SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}" @@ -113,18 +148,16 @@ if test "x${ac_cv_my_have_sdl}" = xno; then LIBS="${save_LIBS}" fi + +dnl Convert all this into conditionals + if test "x${ac_cv_my_have_sdl}" = xno; then - AC_MSG_WARN([SDL not found]) + AC_MSG_WARN([SDL v2 not found]) else AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL) fi AM_CONDITIONAL(USE_SDL, test "x${ac_cv_my_have_sdl}" = xyes) -if test "x${ac_cv_my_have_sdl2}" != xno; then - AC_DEFINE(USE_SDL2, 1, Define to 1 to use SDL) -fi -AM_CONDITIONAL(USE_SDL2, test "x${ac_cv_my_have_sdl2}" = xyes) - if test "x${ac_cv_my_have_sdl_mixer}" = xno; then AC_MSG_WARN([SDL_mixer not found]) else @@ -139,6 +172,10 @@ else fi AM_CONDITIONAL(USE_SDL_IMAGE, test "x${ac_cv_my_have_sdl_image}" = xyes) +if test "x${ac_cv_my_have_old_sdl}" != xno; then + AC_DEFINE(USE_OLD_SDL, 1, Define to 1 to use SDL) +fi +AM_CONDITIONAL(USE_OLD_SDL, test "x${ac_cv_my_have_old_sdl}" = xyes) ])# LOL_CHECK_SDL diff --git a/build/visualstudio/Lol.Core.Vars.props b/build/visualstudio/Lol.Core.Vars.props index c29f35cb..a3fbc639 100644 --- a/build/visualstudio/Lol.Core.Vars.props +++ b/build/visualstudio/Lol.Core.Vars.props @@ -17,7 +17,7 @@ $(SdlDir)\lib\x86_64-msvc;$(SdlImageDir)\lib\x86_64-msvc;$(SdlMixerDir)\lib\x86_64-msvc SDL2.lib;SDL2main.lib;SDL2_image.lib;SDL2_mixer.lib SDL2.lib;SDL2main.lib;SDL2_image.lib;SDL2_mixer.lib - HAVE_SDL_H;USE_SDL;USE_SDL2;$(Win32Defines) + HAVE_SDL_H;USE_SDL;$(Win32Defines) USE_SDL_MIXER;USE_SDL_IMAGE;$(Win32Defines) diff --git a/src/application/application.cpp b/src/application/application.cpp index b95d5478..3caa640f 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -24,7 +24,7 @@ # include "platform/nacl/nacl-app.h" #elif __ANDROID__ # include "platform/android/androidapp.h" -#elif USE_SDL +#elif USE_SDL || USE_OLD_SDL # include "platform/sdl/sdlapp.h" # include "platform/sdl/sdlinput.h" #elif HAVE_GLES_2X @@ -50,7 +50,7 @@ class ApplicationData NaClApp app; #elif __ANDROID__ AndroidApp app; -#elif USE_SDL +#elif USE_SDL || USE_OLD_SDL SdlApp app; #elif HAVE_GLES_2X /* FIXME: this macro is only deactivated if we include "lolgl.h" */ diff --git a/src/eglapp.cpp b/src/eglapp.cpp index cf5664f1..6700be3f 100644 --- a/src/eglapp.cpp +++ b/src/eglapp.cpp @@ -22,8 +22,10 @@ # include #endif -#if defined USE_SDL -# if defined HAVE_SDL_SDL_H +#if USE_SDL || USE_OLD_SDL +# if HAVE_SDL2_SDL_H +# include +# elif HAVE_SDL_SDL_H # include # else # include @@ -32,7 +34,7 @@ #include "lolgl.h" #include "eglapp.h" -#if defined USE_SDL +#if USE_SDL || USE_OLD_SDL # include "platform/sdl/sdlinput.h" #endif @@ -247,7 +249,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : data->screen_size = uvec2(gwa.width, gwa.height); # endif -# if defined USE_SDL +# if USE_SDL || USE_OLD_SDL new SdlInput(res.x, res.y, data->screen_size.x, data->screen_size.y); # endif diff --git a/src/gpu/renderer.cpp b/src/gpu/renderer.cpp index 9fb16309..45b4503e 100644 --- a/src/gpu/renderer.cpp +++ b/src/gpu/renderer.cpp @@ -105,7 +105,7 @@ Renderer::Renderer(ivec2 size) d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferCount = 1; d3dpp.hDeviceWindow = g_hwnd; -# if defined USE_SDL +# if USE_SDL || USE_OLD_SDL d3dpp.Windowed = TRUE; # endif d3dpp.EnableAutoDepthStencil = TRUE; diff --git a/src/lol/engine-internal.h b/src/lol/engine-internal.h index f0ab5487..f33eb7a1 100644 --- a/src/lol/engine-internal.h +++ b/src/lol/engine-internal.h @@ -28,7 +28,7 @@ #endif /* If using SDL on Windows or OS X, let it override main() */ -#if USE_SDL && (_WIN32 || __APPLE__) +#if (USE_SDL || USE_OLD_SDL) && (_WIN32 || __APPLE__) # include #endif diff --git a/src/lol/engine.h b/src/lol/engine.h index 9d7bc2bd..b5651421 100644 --- a/src/lol/engine.h +++ b/src/lol/engine.h @@ -23,7 +23,7 @@ #endif /* If using SDL on Windows or OS X, let it override main() */ -#if USE_SDL && (_WIN32 || __APPLE__) +#if (USE_SDL || USE_OLD_SDL) && (_WIN32 || __APPLE__) # include #endif diff --git a/src/platform/sdl/sdlapp.cpp b/src/platform/sdl/sdlapp.cpp index db9d3b1f..e0955b5e 100644 --- a/src/platform/sdl/sdlapp.cpp +++ b/src/platform/sdl/sdlapp.cpp @@ -10,8 +10,10 @@ #include -#if USE_SDL -# if HAVE_SDL_SDL_H +#if USE_SDL || USE_OLD_SDL +# if HAVE_SDL2_SDL_H +# include +# elif HAVE_SDL_SDL_H # include # else # include @@ -29,7 +31,7 @@ # include "platform/d3d9/d3d9input.h" #endif -#if USE_SDL && USE_D3D9 +#if (USE_SDL || USE_OLD_SDL) && USE_D3D9 HWND g_hwnd = nullptr; #endif @@ -45,10 +47,10 @@ class SdlAppData friend class SdlApp; private: -#if USE_SDL2 +#if USE_SDL SDL_Window *m_window; SDL_GLContext m_glcontext; -#else +#elif USE_OLD_SDL SDL_Surface *m_window; #endif }; @@ -60,7 +62,7 @@ private: SdlApp::SdlApp(char const *title, ivec2 res, float fps) : data(new SdlAppData()) { -#if USE_SDL +#if USE_SDL || USE_OLD_SDL ivec2 window_size = res; ivec2 screen_size = res; @@ -71,7 +73,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : exit(EXIT_FAILURE); } -#if USE_SDL2 +#if USE_SDL data->m_window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_size.x, window_size.y, @@ -136,14 +138,14 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : void SdlApp::ShowPointer(bool show) { -#if defined USE_SDL +#if USE_SDL || USE_OLD_SDL SDL_ShowCursor(show ? 1 : 0); #endif } void SdlApp::Tick() { -#if defined USE_SDL && defined USE_D3D9 +#if (USE_SDL || USE_OLD_SDL) && defined USE_D3D9 IDirect3DDevice9 *d3d_dev = (IDirect3DDevice9 *)g_renderer->GetDevice(); HRESULT hr; hr = d3d_dev->BeginScene(); @@ -154,16 +156,16 @@ void SdlApp::Tick() /* Tick the renderer, show the frame and clamp to desired framerate. */ Ticker::TickDraw(); -#if USE_SDL2 +#if USE_SDL SDL_GL_SwapWindow(data->m_window); -#elif USE_SDL && USE_D3D9 +#elif USE_OLD_SDL && USE_D3D9 hr = d3d_dev->EndScene(); if (FAILED(hr)) Abort(); hr = d3d_dev->Present(nullptr, nullptr, nullptr, nullptr); if (FAILED(hr)) Abort(); -#elif USE_SDL +#elif USE_OLD_SDL SDL_GL_SwapBuffers(); #endif } @@ -173,14 +175,13 @@ SdlApp::~SdlApp() #if USE_SDL if (data->m_window) { -# if USE_SDL2 SDL_GL_DeleteContext(data->m_glcontext); SDL_DestroyWindow(data->m_window); -# else - SDL_DestroySurface(data->m_window); -# endif } - + SDL_Quit(); +#elif USE_OLD_SDL + if (data->m_window) + SDL_DestroySurface(data->m_window); SDL_Quit(); #endif diff --git a/src/platform/sdl/sdlinput.cpp b/src/platform/sdl/sdlinput.cpp index c6ddc21f..f5015cb0 100644 --- a/src/platform/sdl/sdlinput.cpp +++ b/src/platform/sdl/sdlinput.cpp @@ -10,8 +10,10 @@ #include -#if USE_SDL -# if HAVE_SDL_SDL_H +#if USE_SDL || USE_OLD_SDL +# if HAVE_SDL2_SDL_H +# include +# elif HAVE_SDL_SDL_H # include # else # include @@ -48,7 +50,7 @@ private: static ivec2 GetMousePos(); static void SetMousePos(ivec2 position); -#if USE_SDL +#if USE_SDL || USE_OLD_SDL SdlInputData(int app_w, int app_h, int screen_w, int screen_h) : m_prevmouse(ivec2::zero), m_app(vec2((float)app_w, (float)app_h)), @@ -72,16 +74,16 @@ private: */ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) -#if USE_SDL +#if USE_SDL || USE_OLD_SDL : m_data(new SdlInputData(app_w, app_h, screen_w, screen_h)) #endif //USE_SDL { -#if USE_SDL && !USE_SDL2 +#if USE_OLD_SDL /* Enable Unicode translation of keyboard events */ SDL_EnableUNICODE(1); #endif -#if USE_SDL +#if USE_SDL || USE_OLD_SDL SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK); m_data->m_keyboard = InputDeviceInternal::CreateStandardKeyboard(); @@ -104,9 +106,9 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) * - HDAPS, it's not a real joystick. * - X360 controllers, Xinput handles them better since * it won't think there is only one trigger axis. */ -# if USE_SDL2 +# if USE_SDL char const *name = SDL_JoystickName(sdlstick); -# else +# elif USE_OLD_SDL char const *name = SDL_JoystickName(i); # endif if (strstr(name, "HDAPS") @@ -137,7 +139,7 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) SdlInput::~SdlInput() { -#if USE_SDL && !EMSCRIPTEN +#if (USE_SDL || USE_OLD_SDL) && !EMSCRIPTEN /* Unregister all the joysticks we added */ while (m_data->m_joysticks.Count()) { @@ -169,7 +171,7 @@ void SdlInput::TickDraw(float seconds, Scene &scene) void SdlInputData::Tick(float seconds) { -#if USE_SDL +#if USE_SDL || USE_OLD_SDL /* Pump all joystick events because no event is coming to us. */ # if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN SDL_JoystickUpdate(); @@ -202,7 +204,7 @@ void SdlInputData::Tick(float seconds) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { -# if !USE_SDL2 +# if USE_OLD_SDL if (event.button.button != SDL_BUTTON_WHEELUP && event.button.button != SDL_BUTTON_WHEELDOWN) m_mouse->SetKey(event.button.button - 1, event.type == SDL_MOUSEBUTTONDOWN); else @@ -230,9 +232,9 @@ void SdlInputData::Tick(float seconds) if (InputDeviceInternal::GetMouseCapture() != m_mousecapture) { m_mousecapture = InputDeviceInternal::GetMouseCapture(); -# if USE_SDL2 +# if USE_SDL SDL_SetRelativeMouseMode(m_mousecapture ? SDL_TRUE : SDL_FALSE); -# else +# elif USE_OLD_SDL SDL_WM_GrabInput(m_mousecapture ? SDL_GRAB_ON : SDL_GRAB_OFF); # endif mouse = (ivec2)m_app / 2; @@ -258,13 +260,13 @@ void SdlInputData::Tick(float seconds) //Mouse is focused, Validate the InScreen Key //Hardcoded 3, not very nice. -# if !EMSCRIPTEN && !USE_SDL2 +# if !EMSCRIPTEN && USE_OLD_SDL m_mouse->SetKey(3, !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS)); -#else +# else // Emscripten doesn't seem to handle SDL_APPMOUSEFOCUS - // SDL2 doesn't have SDL_APPMOUSEFOCUS either + // FIXME: SDL2 doesn't have SDL_APPMOUSEFOCUS either m_mouse->SetKey(3, true); -#endif +# endif if (m_mousecapture) { @@ -274,9 +276,9 @@ void SdlInputData::Tick(float seconds) m_prevmouse = mouse; -# if USE_SDL2 +# if USE_SDL Uint8 const *sdlstate = SDL_GetKeyboardState(nullptr); -# else +# elif USE_OLD_SDL Uint8 *sdlstate = SDL_GetKeyState(nullptr); # endif @@ -298,27 +300,27 @@ ivec2 SdlInputData::GetMousePos() { ivec2 ret(-1, -1); -#if USE_SDL -# if !EMSCRIPTEN && !USE_SDL2 +#if USE_SDL || USE_OLD_SDL +# if !EMSCRIPTEN && USE_OLD_SDL if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) # endif { SDL_GetMouseState(&ret.x, &ret.y); ret.y = Video::GetSize().y - 1 - ret.y; } -#endif //USE_SDL +#endif return ret; } void SdlInputData::SetMousePos(ivec2 position) { -#if USE_SDL2 +#if USE_SDL // FIXME: how do I warped mouse? -#elif USE_SDL +#elif USE_OLD_SDL SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y); #else UNUSED(position); -#endif //USE_SDL +#endif } } /* namespace lol */