disabled until the engine code itself is ported to SDL2.legacy
@@ -0,0 +1,126 @@ | |||
# LOL_CHECK_SDL() | |||
# --------------- | |||
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_SDL2_SDL_H -- whether to include <SDL2/SDL.h> | |||
dnl HAVE_SDL_SDL_H -- whether to include <SDL/SDL.h> | |||
dnl HAVE_SDL_H -- whether to include <SDL.h> | |||
dnl Generated automake conditionals: | |||
dnl USE_SDL -- whether SDL or SDL2 were found at all (conditional) | |||
dnl USE_SDL_IMAGE -- whether SDL_image was found (conditional) | |||
dnl USE_SDL_MIXER -- whether SDL_mixer was found (conditional) | |||
dnl Generated shell variables: | |||
dnl SDL_CFLAGS -- flags for SDL compilation | |||
dnl SDL_LIBS -- flags for SDL linking | |||
ac_cv_my_have_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 | |||
dnl if test "x${ac_cv_my_have_sdl}" = xno; then | |||
dnl PKG_CHECK_MODULES(SDL2, sdl2, | |||
dnl [ac_cv_my_have_sdl="yes" | |||
dnl PKG_CHECK_MODULES(SDL2MIXER, SDL2_mixer, | |||
dnl [ac_cv_my_have_sdl_mixer="yes" | |||
dnl AC_DEFINE(HAVE_SDL_MIXER_H, 1, Define to 1 to use SDL_mixer.h)], | |||
dnl [:]) | |||
dnl PKG_CHECK_MODULES(SDL2IMAGE, SDL2_image, | |||
dnl [ac_cv_my_have_sdl_image="yes" | |||
dnl AC_DEFINE(HAVE_SDL_IMAGE_H, 1, Define to 1 to use SDL_image.h)], | |||
dnl [:]) | |||
dnl SDL_CFLAGS="${SDL2_CFLAGS} ${SDL2MIXER_CFLAGS} ${SDL2IMAGE_CFLAGS}" | |||
dnl SDL_LIBS="${SDL2_LIBS} ${SDL2MIXER_LIBS} ${SDL2IMAGE_LIBS}" | |||
dnl AC_DEFINE(HAVE_SDL_H, 1, Define to 1 to use SDL.h)], | |||
dnl [:]) | |||
dnl fi | |||
dnl Then, try the proper pkg-config check for SDL 1.x | |||
if test "x${ac_cv_my_have_sdl}" = xno; then | |||
PKG_CHECK_MODULES(SDL, sdl, | |||
[ac_cv_my_have_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)], | |||
[:]) | |||
PKG_CHECK_MODULES(SDLIMAGE, SDL_image, | |||
[ac_cv_my_have_sdl_image="yes" | |||
AC_DEFINE(HAVE_SDL_IMAGE_H, 1, Define to 1 to use SDL_image.h)], | |||
[:]) | |||
SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}" | |||
SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}" | |||
AC_DEFINE(HAVE_SDL_H, 1, Define to 1 to use SDL.h)], | |||
[:]) | |||
fi | |||
dnl Then the old sdl-config method | |||
if test "x${cross_compiling}" != xyes -a "x${ac_cv_my_have_sdl}" = xno; then | |||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no) | |||
if test "${SDL_CONFIG}" != "no"; then | |||
ac_cv_my_have_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 | |||
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_LIB(SDL, main, | |||
[SDL_LIBS="${SDL_LIBS} -lSDL"], | |||
[ac_cv_my_have_sdl="no"]) | |||
AC_CHECK_LIB(SDLmain, main, | |||
[SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"]) | |||
AC_CHECK_LIB(SDL_mixer, main, | |||
[SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"], | |||
[ac_cv_my_have_sdl_mixer="no"]) | |||
AC_CHECK_LIB(SDL_image, main, | |||
[SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_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 | |||
if test "x${ac_cv_my_have_sdl}" = xno; then | |||
AC_MSG_WARN([SDL 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_sdl_mixer}" = xno; then | |||
AC_MSG_WARN([SDL_mixer not found]) | |||
else | |||
AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer) | |||
fi | |||
AM_CONDITIONAL(USE_SDL_MIXER, test "x${ac_cv_my_have_sdl_mixer}" = xyes) | |||
if test "x${ac_cv_my_have_sdl_image}" = xno; then | |||
AC_MSG_WARN([SDL_image not found]) | |||
else | |||
AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image) | |||
fi | |||
AM_CONDITIONAL(USE_SDL_IMAGE, test "x${ac_cv_my_have_sdl_image}" = xyes) | |||
])# LOL_CHECK_SDL | |||
@@ -218,69 +218,7 @@ dnl Are we on a Direct3D 9 platform? | |||
LOL_CHECK_OPENGL | |||
dnl Use SDL? (always required on Linux or Win32) | |||
ac_cv_my_have_sdl="no" | |||
ac_cv_my_have_sdl_image="no" | |||
ac_cv_my_have_sdl_mixer="no" | |||
dnl | |||
dnl First, try the proper pkg-config check | |||
PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:]) | |||
PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:]) | |||
PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:]) | |||
dnl | |||
dnl Then the old sdl-config method | |||
if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then | |||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no) | |||
if test "${SDL_CONFIG}" != "no"; then | |||
SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`" | |||
SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`" | |||
ac_cv_my_have_sdl="yes" | |||
fi | |||
fi | |||
dnl | |||
dnl Maybe all this has failed, try direct inclusion | |||
save_CPPFLAGS="${CPPFLAGS}" | |||
save_LIBS="${LIBS}" | |||
CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}" | |||
LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}" | |||
AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"]) | |||
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_cv_my_have_sdl="no"]) | |||
AC_CHECK_LIB(SDLmain, main, | |||
[SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"]) | |||
AC_CHECK_LIB(SDL_mixer, main, | |||
[SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"], | |||
[ac_cv_my_have_sdl_mixer="no"]) | |||
AC_CHECK_LIB(SDL_image, main, | |||
[SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"], | |||
[ac_cv_my_have_sdl_image="no"]) | |||
SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}" | |||
SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}" | |||
CPPFLAGS="${save_CPPFLAGS}" | |||
LIBS="${save_LIBS}" | |||
if test "${ac_cv_my_have_sdl}" = "no"; then | |||
AC_MSG_WARN([SDL not found]) | |||
else | |||
AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL) | |||
fi | |||
if test "${ac_cv_my_have_sdl_mixer}" = "no"; then | |||
AC_MSG_WARN([SDL_mixer not found]) | |||
else | |||
AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer) | |||
fi | |||
if test "${ac_cv_my_have_sdl_image}" = "no"; then | |||
AC_MSG_WARN([SDL_image not found]) | |||
else | |||
AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image) | |||
fi | |||
AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes") | |||
AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes") | |||
AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes") | |||
LOL_CHECK_SDL | |||
dnl Use Flex's FlexLexer.h or ours? | |||
ac_cv_my_have_flexlexer_h="no" | |||
@@ -54,7 +54,7 @@ class ApplicationData | |||
#elif defined HAVE_GLES_2X | |||
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ | |||
EglApp app; | |||
#elif defined HAVE_SDL_H | |||
#elif defined HAVE_SDL_H || defined HAVE_SDL_SDL_H | |||
SdlApp app; | |||
#else | |||
# error No application class available on this platform | |||
@@ -25,7 +25,7 @@ | |||
#endif | |||
#if defined USE_SDL | |||
# if defined HAVE_SDL_SDL_H | |||
# if defined HAVE_SDL_H || defined HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
# else | |||
# include <SDL.h> | |||
@@ -115,11 +115,11 @@ int InputTracker::GetPreviousButtonStatus(Key k) | |||
void InputTracker::UpdateActionStatus(float seconds) | |||
{ | |||
#if defined USE_SDL | |||
#if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3 | |||
# if SDL_VERSION_ATLEAST(1,3,0) | |||
Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||
#else | |||
# else | |||
Uint8 *keystate = SDL_GetKeyState(NULL); | |||
#endif | |||
# endif | |||
//SOOOoooo ugly. | |||
for (int i = 0; i < Key::Last; ++i) | |||
{ | |||
@@ -269,11 +269,11 @@ vec2 Input::GetAxis(int axis) | |||
#if defined USE_SDL | |||
/* Simulate a joystick using the keyboard. This SDL call is free. */ | |||
#if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3 | |||
# if SDL_VERSION_ATLEAST(1,3,0) | |||
Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||
#else | |||
# else | |||
Uint8 *keystate = SDL_GetKeyState(NULL); | |||
#endif | |||
# endif | |||
int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]); | |||
int up = (keystate[SDLK_w] | keystate[SDLK_z]) - keystate[SDLK_s] ; | |||
ret.x += left; | |||
@@ -302,7 +302,7 @@ ivec3 Input::GetMouseButtons() | |||
int Input::GetButtonState(int button) | |||
{ | |||
#if defined USE_SDL | |||
# if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION >= 3 | |||
# if SDL_VERSION_ATLEAST(1,3,0) | |||
Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||
# else | |||
Uint8 *keystate = SDL_GetKeyState(NULL); | |||
@@ -13,7 +13,9 @@ | |||
#endif | |||
#if defined USE_SDL | |||
# if defined HAVE_SDL_SDL_H | |||
# if defined HAVE_SDL2_SDL_H | |||
# include <SDL2/SDL.h> | |||
# elif defined HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
# else | |||
# include <SDL.h> | |||
@@ -73,6 +75,8 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||
SDL_VERSION(&wminfo.version); | |||
SDL_GetWMInfo(&wminfo); | |||
g_hwnd = wminfo.window; | |||
# elif SDL_VERSION_ATLEAST(2,0,0) | |||
TODO | |||
# else | |||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | |||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); | |||
@@ -30,7 +30,7 @@ | |||
# include <sys/sys_time.h> | |||
# include <sys/timer.h> | |||
# include <sys/time_util.h> | |||
#elif defined HAVE_SDL_SDL_H | |||
#elif defined HAVE_SDL_H || defined HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
#else | |||
# include <SDL.h> | |||