Browse Source

build: fix Win64 compilation with mingw64, using an updated SDL build.

legacy
Sam Hocevar sam 14 years ago
parent
commit
beb141dd5b
4 changed files with 16 additions and 12 deletions
  1. +4
    -0
      configure.ac
  2. +2
    -2
      src/audio.cpp
  3. +5
    -5
      src/image/image.cpp
  4. +5
    -5
      src/sample.cpp

+ 4
- 0
configure.ac View File

@@ -219,9 +219,13 @@ else
fi fi
if test "${ac_cv_my_have_sdl_mixer}" = "no"; then if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
AC_MSG_WARN([SDL_mixer not found]) AC_MSG_WARN([SDL_mixer not found])
else
AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
fi fi
if test "${ac_cv_my_have_sdl_image}" = "no"; then if test "${ac_cv_my_have_sdl_image}" = "no"; then
AC_MSG_WARN([SDL_image not found]) AC_MSG_WARN([SDL_image not found])
else
AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
fi fi
AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes") 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_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")


+ 2
- 2
src/audio.cpp View File

@@ -14,7 +14,7 @@


#include <cmath> #include <cmath>


#if defined USE_SDL
#if defined USE_SDL_MIXER
# include <SDL.h> # include <SDL.h>
# include <SDL_mixer.h> # include <SDL_mixer.h>
#endif #endif
@@ -30,7 +30,7 @@ namespace lol


void Audio::Setup(int channels) void Audio::Setup(int channels)
{ {
#if defined USE_SDL
#if defined USE_SDL_MIXER
Mix_OpenAudio(22050, AUDIO_S16, channels, 1024); Mix_OpenAudio(22050, AUDIO_S16, channels, 1024);
#endif #endif
} }


+ 5
- 5
src/image/image.cpp View File

@@ -16,7 +16,7 @@


#if defined __APPLE__ && defined __MACH__ #if defined __APPLE__ && defined __MACH__
# import <UIKit/UIKit.h> # import <UIKit/UIKit.h>
#elif defined USE_SDL
#elif defined USE_SDL_IMAGE
# include <SDL.h> # include <SDL.h>
# include <SDL_image.h> # include <SDL_image.h>
#elif defined __ANDROID__ #elif defined __ANDROID__
@@ -53,7 +53,7 @@ private:


#if defined __APPLE__ && defined __MACH__ #if defined __APPLE__ && defined __MACH__
uint8_t *pixels; uint8_t *pixels;
#elif defined USE_SDL
#elif defined USE_SDL_IMAGE
SDL_Surface *img; SDL_Surface *img;
#elif defined __ANDROID__ #elif defined __ANDROID__
jobject bmp; jobject bmp;
@@ -109,7 +109,7 @@ Image::Image(char const *path)
CGContextRelease(ctx); CGContextRelease(ctx);
[image release]; [image release];
[pngdata release]; [pngdata release];
#elif defined USE_SDL
#elif defined USE_SDL_IMAGE
for (char const *name = path; *name; name++) for (char const *name = path; *name; name++)
if ((data->img = IMG_Load(name))) if ((data->img = IMG_Load(name)))
break; break;
@@ -334,7 +334,7 @@ void * Image::GetData() const
{ {
#if defined __APPLE__ && defined __MACH__ #if defined __APPLE__ && defined __MACH__
return data->pixels; return data->pixels;
#elif defined USE_SDL
#elif defined USE_SDL_IMAGE
return data->img->pixels; return data->img->pixels;
#elif defined __ANDROID__ #elif defined __ANDROID__
return data->pixels; return data->pixels;
@@ -349,7 +349,7 @@ Image::~Image()
{ {
#if defined __APPLE__ && defined __MACH__ #if defined __APPLE__ && defined __MACH__
free(data->pixels); free(data->pixels);
#elif defined USE_SDL
#elif defined USE_SDL_IMAGE
SDL_FreeSurface(data->img); SDL_FreeSurface(data->img);
#elif defined __ANDROID__ #elif defined __ANDROID__
JNIEnv *env; JNIEnv *env;


+ 5
- 5
src/sample.cpp View File

@@ -17,7 +17,7 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>


#if defined USE_SDL
#if defined USE_SDL_MIXER
# include <SDL.h> # include <SDL.h>
# include <SDL_mixer.h> # include <SDL_mixer.h>
#endif #endif
@@ -39,7 +39,7 @@ class SampleData


private: private:
char *name, *path; char *name, *path;
#if defined USE_SDL
#if defined USE_SDL_MIXER
Mix_Chunk *chunk; Mix_Chunk *chunk;
#endif #endif
}; };
@@ -55,7 +55,7 @@ Sample::Sample(char const *path)
data->path = data->name + 9; data->path = data->name + 9;
sprintf(data->name, "<sample> %s", path); sprintf(data->name, "<sample> %s", path);


#if defined USE_SDL
#if defined USE_SDL_MIXER
data->chunk = Mix_LoadWAV(path); data->chunk = Mix_LoadWAV(path);
if (!data->chunk) if (!data->chunk)
{ {
@@ -70,7 +70,7 @@ Sample::Sample(char const *path)


Sample::~Sample() Sample::~Sample()
{ {
#if defined USE_SDL
#if defined USE_SDL_MIXER
Mix_FreeChunk(data->chunk); Mix_FreeChunk(data->chunk);
#endif #endif
free(data->name); free(data->name);
@@ -89,7 +89,7 @@ char const *Sample::GetName()


void Sample::Play() void Sample::Play()
{ {
#if defined USE_SDL
#if defined USE_SDL_MIXER
Mix_PlayChannel(-1, data->chunk, 0); Mix_PlayChannel(-1, data->chunk, 0);
#endif #endif
} }


Loading…
Cancel
Save