From e11cd5a962803747ce3c0bddaef73a47d8938b63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Sep 2008 05:38:28 +0000 Subject: game engine now compiles with SDL disabled. CDROM and Joystick wont function in this case --- intern/SoundSystem/SConscript | 3 +++ intern/SoundSystem/sdl/SND_SDLCDDevice.cpp | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript index baf680f03f0..be19c4b7915 100644 --- a/intern/SoundSystem/SConscript +++ b/intern/SoundSystem/SConscript @@ -14,4 +14,7 @@ if env['WITH_BF_OPENAL']: else: defs = 'NO_SOUND' +if not env['WITH_BF_SDL']: + defs += ' DISABLE_SDL' + env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [20,140] ) diff --git a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp index 8bb6c642b11..0ab0fa94c7b 100644 --- a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp +++ b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp @@ -55,6 +55,10 @@ SND_SDLCDDevice::SND_SDLCDDevice() : void SND_SDLCDDevice::init() { +#ifdef DISABLE_SDL + fprintf(stderr, "Blender compiled without SDL, no CDROM support\n"); + return; +#else if (SDL_InitSubSystem(SDL_INIT_CDROM)) { fprintf(stderr, "Error initializing CDROM\n"); @@ -75,19 +79,23 @@ void SND_SDLCDDevice::init() /* Did if open? Check if cdrom is NULL */ if(!m_cdrom) { - fprintf(stderr, "Couldn't open drive: %s", SDL_GetError()); + fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError()); return; } +#endif } SND_SDLCDDevice::~SND_SDLCDDevice() { +#ifndef DISABLE_SDL StopCD(); SDL_CDClose(m_cdrom); +#endif } void SND_SDLCDDevice::NextFrame() { +#ifndef DISABLE_SDL m_frame++; m_frame &= 127; @@ -111,20 +119,24 @@ void SND_SDLCDDevice::NextFrame() } } +#endif } void SND_SDLCDDevice::PlayCD(int track) { +#ifndef DISABLE_SDL if ( m_cdrom && CD_INDRIVE(SDL_CDStatus(m_cdrom)) ) { SDL_CDPlayTracks(m_cdrom, track-1, 0, track, 0); m_cdplaying = true; m_cdtrack = track; } +#endif } void SND_SDLCDDevice::PauseCD(bool pause) { +#ifndef DISABLE_SDL if (!m_cdrom) return; @@ -132,13 +144,16 @@ void SND_SDLCDDevice::PauseCD(bool pause) SDL_CDPause(m_cdrom); else SDL_CDResume(m_cdrom); +#endif } void SND_SDLCDDevice::StopCD() { +#ifndef DISABLE_SDL if (m_cdrom) SDL_CDStop(m_cdrom); m_cdplaying = false; +#endif } void SND_SDLCDDevice::SetCDPlaymode(int playmode) -- cgit v1.2.3