X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2FCore%2FVideo.xs;h=a7a6b34d4d11a8467873463b7528c8069f464559;hb=eaf32d63cd5d036a165cbbcb1200bca441d2aa84;hp=401642080a57fdd3827922b2e87bc1562bc35e9f;hpb=95f5be308db86ed665a21a6d0c99aa5acb0b3409;p=sdlgit%2FSDL_perl.git diff --git a/src/Core/Video.xs b/src/Core/Video.xs index 4016420..a7a6b34 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -30,34 +30,86 @@ video_get_video_surface() RETVAL -HV * +SDL_VideoInfo* video_get_video_info() + PREINIT: + char* CLASS = "SDL::VideoInfo"; + CODE: + RETVAL = (SDL_VideoInfo *) SDL_GetVideoInfo(); + + OUTPUT: + RETVAL + +SV * +video_video_driver_name( ) + CODE: - HV *hv; - SDL_VideoInfo *info; - info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo)); - memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo)); - hv = newHV(); - hv_store(hv,"hw_available",strlen("hw_available"), - newSViv(info->hw_available),0); - hv_store(hv,"wm_available",strlen("wm_available"), - newSViv(info->wm_available),0); - hv_store(hv,"blit_hw",strlen("blit_hw"), - newSViv(info->blit_hw),0); - hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"), - newSViv(info->blit_hw_CC),0); - hv_store(hv,"blit_hw_A",strlen("blit_hw_A"), - newSViv(info->blit_hw_A),0); - hv_store(hv,"blit_sw",strlen("blit_sw"), - newSViv(info->blit_sw),0); - hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"), - newSViv(info->blit_sw_CC),0); - hv_store(hv,"blit_sw_A",strlen("blit_sw_A"), - newSViv(info->blit_sw_A),0); - hv_store(hv,"blit_fill",strlen("blit_fill"), - newSViv(info->blit_fill),0); - hv_store(hv,"video_mem",strlen("video_mem"), - newSViv(info->video_mem),0); - RETVAL = hv; - OUTPUT: + char buffer[1024]; + if ( SDL_VideoDriverName(buffer, 1024) != NULL ) + { + RETVAL = newSVpv(buffer, 0); + } + else + XSRETURN_UNDEF; + OUTPUT: + RETVAL + +AV* +list_modes ( format, flags ) + Uint32 flags + SDL_PixelFormat *format + + CODE: + SDL_Rect **mode; + RETVAL = newAV(); + mode = SDL_ListModes(format,flags); + if (mode == (SDL_Rect**)-1 ) { + av_push(RETVAL,newSVpv("all",0)); + } else if (! mode ) { + av_push(RETVAL,newSVpv("none",0)); + } else { + for (;*mode;mode++) { + av_push(RETVAL,newSViv(PTR2IV(*mode))); + } + } + OUTPUT: RETVAL + + +int +video_video_mode_ok ( width, height, bpp, flags ) + int width + int height + int bpp + Uint32 flags + CODE: + RETVAL = SDL_VideoModeOK(width,height,bpp,flags); + OUTPUT: + RETVAL + +void +video_update_rect ( surface, x, y, w ,h ) + SDL_Surface *surface + int x + int y + int w + int h + CODE: + SDL_UpdateRect(surface,x,y,w,h); + +void +video_update_rects ( surface, ... ) + SDL_Surface *surface + CODE: + SDL_Rect *rects; + int num_rects,i; + if ( items < 2 ) return; + num_rects = items - 1; + rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items); + for(i=0;i