From beb141dd5b9c73c58ccbeb96aae2941117f3fec2 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 13 Sep 2011 17:19:11 +0000 Subject: [PATCH] build: fix Win64 compilation with mingw64, using an updated SDL build. --- configure.ac | 4 ++++ src/audio.cpp | 4 ++-- src/image/image.cpp | 10 +++++----- src/sample.cpp | 10 +++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 0397604b..c24bd345 100644 --- a/configure.ac +++ b/configure.ac @@ -219,9 +219,13 @@ else 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") diff --git a/src/audio.cpp b/src/audio.cpp index 2fc2b387..1882e68e 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -14,7 +14,7 @@ #include -#if defined USE_SDL +#if defined USE_SDL_MIXER # include # include #endif @@ -30,7 +30,7 @@ namespace lol void Audio::Setup(int channels) { -#if defined USE_SDL +#if defined USE_SDL_MIXER Mix_OpenAudio(22050, AUDIO_S16, channels, 1024); #endif } diff --git a/src/image/image.cpp b/src/image/image.cpp index 22a1c4b1..c55740e3 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -16,7 +16,7 @@ #if defined __APPLE__ && defined __MACH__ # import -#elif defined USE_SDL +#elif defined USE_SDL_IMAGE # include # include #elif defined __ANDROID__ @@ -53,7 +53,7 @@ private: #if defined __APPLE__ && defined __MACH__ uint8_t *pixels; -#elif defined USE_SDL +#elif defined USE_SDL_IMAGE SDL_Surface *img; #elif defined __ANDROID__ jobject bmp; @@ -109,7 +109,7 @@ Image::Image(char const *path) CGContextRelease(ctx); [image release]; [pngdata release]; -#elif defined USE_SDL +#elif defined USE_SDL_IMAGE for (char const *name = path; *name; name++) if ((data->img = IMG_Load(name))) break; @@ -334,7 +334,7 @@ void * Image::GetData() const { #if defined __APPLE__ && defined __MACH__ return data->pixels; -#elif defined USE_SDL +#elif defined USE_SDL_IMAGE return data->img->pixels; #elif defined __ANDROID__ return data->pixels; @@ -349,7 +349,7 @@ Image::~Image() { #if defined __APPLE__ && defined __MACH__ free(data->pixels); -#elif defined USE_SDL +#elif defined USE_SDL_IMAGE SDL_FreeSurface(data->img); #elif defined __ANDROID__ JNIEnv *env; diff --git a/src/sample.cpp b/src/sample.cpp index 9a80c080..bb518181 100644 --- a/src/sample.cpp +++ b/src/sample.cpp @@ -17,7 +17,7 @@ #include #include -#if defined USE_SDL +#if defined USE_SDL_MIXER # include # include #endif @@ -39,7 +39,7 @@ class SampleData private: char *name, *path; -#if defined USE_SDL +#if defined USE_SDL_MIXER Mix_Chunk *chunk; #endif }; @@ -55,7 +55,7 @@ Sample::Sample(char const *path) data->path = data->name + 9; sprintf(data->name, " %s", path); -#if defined USE_SDL +#if defined USE_SDL_MIXER data->chunk = Mix_LoadWAV(path); if (!data->chunk) { @@ -70,7 +70,7 @@ Sample::Sample(char const *path) Sample::~Sample() { -#if defined USE_SDL +#if defined USE_SDL_MIXER Mix_FreeChunk(data->chunk); #endif free(data->name); @@ -89,7 +89,7 @@ char const *Sample::GetName() void Sample::Play() { -#if defined USE_SDL +#if defined USE_SDL_MIXER Mix_PlayChannel(-1, data->chunk, 0); #endif }