Finished VideoMode and changed some aliases in ContextSettings.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1634 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
groogy 2010-11-11 12:33:14 +00:00
parent 13b91bf116
commit 462c5723df
2 changed files with 66 additions and 0 deletions

View File

@ -211,16 +211,28 @@ void Init_ContextSettings( void )
// Aliases // Aliases
rb_define_alias( globalContextSettingsClass, "depth", "depthBits" ); rb_define_alias( globalContextSettingsClass, "depth", "depthBits" );
rb_define_alias( globalContextSettingsClass, "depth=", "depthBits=" ); rb_define_alias( globalContextSettingsClass, "depth=", "depthBits=" );
rb_define_alias( globalContextSettingsClass, "depth_bits", "depthBits" );
rb_define_alias( globalContextSettingsClass, "depth_bits=", "depthBits=" );
rb_define_alias( globalContextSettingsClass, "stencil", "stencilBits" ); rb_define_alias( globalContextSettingsClass, "stencil", "stencilBits" );
rb_define_alias( globalContextSettingsClass, "stencil=", "stencilBits=" ); rb_define_alias( globalContextSettingsClass, "stencil=", "stencilBits=" );
rb_define_alias( globalContextSettingsClass, "stencil_bits", "stencilBits" );
rb_define_alias( globalContextSettingsClass, "stencil_bits=", "stencilBits=" );
rb_define_alias( globalContextSettingsClass, "antialiasing", "antialiasingLevel" ); rb_define_alias( globalContextSettingsClass, "antialiasing", "antialiasingLevel" );
rb_define_alias( globalContextSettingsClass, "antialiasing=", "antialiasingLevel=" ); rb_define_alias( globalContextSettingsClass, "antialiasing=", "antialiasingLevel=" );
rb_define_alias( globalContextSettingsClass, "antialiasing_level", "antialiasingLevel" );
rb_define_alias( globalContextSettingsClass, "antialiasing_level=", "antialiasingLevel=" );
rb_define_alias( globalContextSettingsClass, "major", "majorVersion" ); rb_define_alias( globalContextSettingsClass, "major", "majorVersion" );
rb_define_alias( globalContextSettingsClass, "major=", "majorVersion=" ); rb_define_alias( globalContextSettingsClass, "major=", "majorVersion=" );
rb_define_alias( globalContextSettingsClass, "major_version", "majorVersion" );
rb_define_alias( globalContextSettingsClass, "major_version=", "majorVersion=" );
rb_define_alias( globalContextSettingsClass, "minor", "minorVersion" ); rb_define_alias( globalContextSettingsClass, "minor", "minorVersion" );
rb_define_alias( globalContextSettingsClass, "minor=", "minorVersion=" ); rb_define_alias( globalContextSettingsClass, "minor=", "minorVersion=" );
rb_define_alias( globalContextSettingsClass, "minor_version", "minorVersion" );
rb_define_alias( globalContextSettingsClass, "minor_version=", "minorVersion=" );
} }

View File

@ -65,6 +65,48 @@ static void VideoMode_Free( sf::VideoMode *anObject )
delete anObject; delete anObject;
} }
static VALUE VideoMode_GetWidth( VALUE self )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->Width );
}
static VALUE VideoMode_SetWidth( VALUE self, VALUE aValue )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->Width = NUM2UINT( aValue ) );
}
static VALUE VideoMode_GetHeight( VALUE self )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->Height );
}
static VALUE VideoMode_SetHeight( VALUE self, VALUE aValue )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->Height = NUM2UINT( aValue ) );
}
static VALUE VideoMode_GetBitsPerPixel( VALUE self )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->BitsPerPixel );
}
static VALUE VideoMode_SetBitsPerPixel( VALUE self, VALUE aValue )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
return INT2FIX( object->BitsPerPixel = NUM2UINT( aValue ) );
}
static VALUE VideoMode_GetDesktopMode( VALUE aKlass ) static VALUE VideoMode_GetDesktopMode( VALUE aKlass )
{ {
sf::VideoMode *object = new sf::VideoMode( sf::VideoMode::GetDesktopMode() ); sf::VideoMode *object = new sf::VideoMode( sf::VideoMode::GetDesktopMode() );
@ -120,6 +162,18 @@ void Init_VideoMode( void )
rb_define_singleton_method( globalVideoModeClass, "getFullscreenModes", FUNCPTR( VideoMode_GetFullscreenModes ), 0 ); rb_define_singleton_method( globalVideoModeClass, "getFullscreenModes", FUNCPTR( VideoMode_GetFullscreenModes ), 0 );
// Instance methods // Instance methods
rb_define_method( globalVideoModeClass, "width", FUNCPTR( VideoMode_GetWidth ), 0 );
rb_define_method( globalVideoModeClass, "width=", FUNCPTR( VideoMode_SetWidth ), 1 );
rb_define_method( globalVideoModeClass, "height", FUNCPTR( VideoMode_GetWidth ), 0 );
rb_define_method( globalVideoModeClass, "height=", FUNCPTR( VideoMode_SetWidth ), 1 );
rb_define_method( globalVideoModeClass, "bitsPerPixel", FUNCPTR( VideoMode_GetBitsPerPixel ), 0 );
rb_define_method( globalVideoModeClass, "bitsPerPixel=", FUNCPTR( VideoMode_SetBitsPerPixel ), 1 );
// Aliases // Aliases
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=" );
} }