X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2FSDL.xs;h=07b3d0b35a3b45d16a512ff62037bebe74206644;hb=8898221d8f4f62490daab29e054fe38d824bf6d1;hp=599340da542c8a95cba66df83d017a8d897650d0;hpb=85fcc9eeb543c9713521aa7d86ccdb985687fe44;p=sdlgit%2FSDL_perl.git diff --git a/src/SDL.xs b/src/SDL.xs index 599340d..07b3d0b 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -97,7 +97,27 @@ static int sdl_perl_use_smpeg_audio = 0; #define HAVE_TLS_CONTEXT #endif -#include "src/defines.h" +/* For windows */ +#ifndef SDL_PERL_DEFINES_H +#define SDL_PERL_DEFINES_H + +#ifdef HAVE_TLS_CONTEXT +PerlInterpreter *parent_perl = NULL; +extern PerlInterpreter *parent_perl; +#define GET_TLS_CONTEXT parent_perl = PERL_GET_CONTEXT; +#define ENTER_TLS_CONTEXT \ + PerlInterpreter *current_perl = PERL_GET_CONTEXT; \ + PERL_SET_CONTEXT(parent_perl); { \ + PerlInterpreter *my_perl = parent_perl; +#define LEAVE_TLS_CONTEXT \ + } PERL_SET_CONTEXT(current_perl); +#else +#define GET_TLS_CONTEXT /* TLS context not enabled */ +#define ENTER_TLS_CONTEXT /* TLS context not enabled */ +#define LEAVE_TLS_CONTEXT /* TLS context not enabled */ +#endif + +#endif Uint32 sdl_perl_timer_callback ( Uint32 interval, void* param ) @@ -1303,6 +1323,21 @@ ColorB ( color, ... ) OUTPUT: RETVAL + +void +ColorRGB ( color, ... ) + SDL_Color *color + PPCODE: + if (items > 1 ) { + color->r = SvIV(ST(1)); + color->g = SvIV(ST(2)); + color->b = SvIV(ST(3)); + } + mXPUSHi( color->r ); + mXPUSHi( color->g ); + mXPUSHi( color->b ); + XSRETURN(3); + void FreeColor ( color ) SDL_Color *color @@ -1379,10 +1414,11 @@ void UpdateRects ( surface, ... ) SDL_Surface *surface CODE: - SDL_Rect *rects, *temp; + SDL_Rect *rects, *oldrects, *temp; int num_rects,i; if ( items < 2 ) return; - num_rects = items - 1; + num_rects = items - 1; + oldrects = rects; rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items); for(i=0;i