From: Kartik Thakore Date: Thu, 29 Oct 2009 21:41:20 +0000 (-0400) Subject: Fixes for windows directx and windbi drivers on version of libsdl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50b9c65df82610f9c322a8f743907f3006aa02db;p=sdlgit%2FSDL_perl.git Fixes for windows directx and windbi drivers on version of libsdl --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index f080344..a8a9a1e 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -8,7 +8,6 @@ #include -#define WARNMSG "is unsupported in windows. Contact us at #sdl irc.perl.org or sdl-devel@perl.org for help." static Uint16* av_to_uint16 (AV* av) { @@ -226,13 +225,7 @@ video_set_gamma(r, g, b) float g; float b; CODE: - RETVAL = -1; -#if defined WIN32 || WINDOWS - warn( "set_gamma: %s", WARNMSG ); -#else RETVAL = SDL_SetGamma(r,g,b); -#endif - OUTPUT: RETVAL @@ -243,9 +236,6 @@ video_set_gamma_ramp( rt, gt, bt ) AV* gt; AV* bt; CODE: -#if defined WIN32 || WINDOWS - warn( "set_gamma_ramp: %s", WARNMSG ); -#else Uint16 *redtable, *greentable, *bluetable; redtable = av_to_uint16(rt); greentable = av_to_uint16(gt); @@ -254,7 +244,6 @@ video_set_gamma_ramp( rt, gt, bt ) if( redtable != NULL) { safefree(redtable); } if( greentable != NULL) { safefree(greentable); } if( bluetable != NULL) { safefree(bluetable); } -#endif OUTPUT: RETVAL diff --git a/src/SDL.xs b/src/SDL.xs index 8e14ce2..5711e3a 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -110,6 +110,20 @@ extern PerlInterpreter *parent_perl; #endif +void +windows_force_driver () +{ + const SDL_version *version = SDL_Linked_Version(); + if(version->patch == 14) + { + putenv("SDL_VIDEODRIVER=directx"); + } + else + { + putenv("SDL_VIDEODRIVER=windib"); + } +} + Uint32 sdl_perl_timer_callback ( Uint32 interval, void* param ) { @@ -254,6 +268,9 @@ init ( flags ) Uint32 flags CODE: INIT_NS_APPLICATION +#if defined WINDOWS || WIN32 + windows_force_driver(); +#endif RETVAL = SDL_Init(flags); #ifdef HAVE_TLS_CONTEXT Perl_call_atexit(PERL_GET_CONTEXT, (void*)sdl_perl_atexit,0);