Forgot to add the isValid method to the SFML::VideoMode class. Fixed now.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1720 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
groogy 2010-11-27 22:51:38 +00:00
parent 13f062220b
commit 888d4f7585

View File

@ -138,6 +138,21 @@ static VALUE VideoMode_SetBitsPerPixel( VALUE self, VALUE aValue )
return INT2FIX( object->BitsPerPixel = NUM2UINT( aValue ) ); return INT2FIX( object->BitsPerPixel = NUM2UINT( aValue ) );
} }
/* call-seq:
* mode.isValid() -> true or false
*
* Tell whether or not the video mode is valid.
*
* The validity of video modes is only relevant when using fullscreen windows; otherwise any video mode can be used
* with no restriction.
*/
static VALUE VideoMode_IsValid( VALUE self )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return ( object->IsValid() == true ? Qtrue : Qfalse );
}
/* call-seq: /* call-seq:
* VideoMode.getDesktopMode -> desktop_mode * VideoMode.getDesktopMode -> desktop_mode
* *
@ -255,6 +270,8 @@ void Init_VideoMode( void )
rb_define_method( globalVideoModeClass, "bitsPerPixel", VideoMode_GetBitsPerPixel, 0 ); rb_define_method( globalVideoModeClass, "bitsPerPixel", VideoMode_GetBitsPerPixel, 0 );
rb_define_method( globalVideoModeClass, "bitsPerPixel=", VideoMode_SetBitsPerPixel, 1 ); rb_define_method( globalVideoModeClass, "bitsPerPixel=", VideoMode_SetBitsPerPixel, 1 );
rb_define_method( globalVideoModeClass, "isValid", VideoMode_IsValid, 0 );
// Class aliases // Class aliases
rb_define_alias( CLASS_OF( globalVideoModeClass ), "desktopMode", "getDesktopMode" ); rb_define_alias( CLASS_OF( globalVideoModeClass ), "desktopMode", "getDesktopMode" );
rb_define_alias( CLASS_OF( globalVideoModeClass ), "desktop_mode", "getDesktopMode" ); rb_define_alias( CLASS_OF( globalVideoModeClass ), "desktop_mode", "getDesktopMode" );
@ -266,4 +283,7 @@ void Init_VideoMode( void )
rb_define_alias( globalVideoModeClass, "bits_per_pixel=", "bitsPerPixel=" ); rb_define_alias( globalVideoModeClass, "bits_per_pixel=", "bitsPerPixel=" );
rb_define_alias( globalVideoModeClass, "bpp", "bitsPerPixel" ); rb_define_alias( globalVideoModeClass, "bpp", "bitsPerPixel" );
rb_define_alias( globalVideoModeClass, "bpp=", "bitsPerPixel=" ); rb_define_alias( globalVideoModeClass, "bpp=", "bitsPerPixel=" );
rb_define_alias( globalVideoModeClass, "is_valid", "isValid" );
rb_define_alias( globalVideoModeClass, "valid?", "isValid" );
} }