Added list_modes
Kartik Thakore [Fri, 23 Oct 2009 22:44:22 +0000 (18:44 -0400)]
src/Core/Video.xs
t/core_video.t

index 29a18ee..753bca6 100644 (file)
@@ -53,3 +53,27 @@ video_video_driver_name( )
                         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
+
+
+
+
index 16a7da0..66c9503 100644 (file)
@@ -13,6 +13,7 @@ can_ok ('SDL::Video', qw/
        get_video_surface
        get_video_info
        video_driver_name
+       list_modes
        /);
 
 #testing get_video_surface
@@ -35,7 +36,6 @@ pass '[video_driver_name] This is your driver name: '.$driver_name;
 pass "Are we still alive?";
 
 =skip
-       list_modes
        video_mode_ok
        set_video_mode
        update_rect