diff --git a/bindings/ruby/sfml-window/window/ContextSettings.cpp b/bindings/ruby/sfml-window/window/ContextSettings.cpp index b7c119335..631b63395 100644 --- a/bindings/ruby/sfml-window/window/ContextSettings.cpp +++ b/bindings/ruby/sfml-window/window/ContextSettings.cpp @@ -211,16 +211,28 @@ void Init_ContextSettings( void ) // Aliases 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_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_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_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_version", "minorVersion" ); + rb_define_alias( globalContextSettingsClass, "minor_version=", "minorVersion=" ); + + } diff --git a/bindings/ruby/sfml-window/window/VideoMode.cpp b/bindings/ruby/sfml-window/window/VideoMode.cpp index a92c3b454..8e0f0d52c 100644 --- a/bindings/ruby/sfml-window/window/VideoMode.cpp +++ b/bindings/ruby/sfml-window/window/VideoMode.cpp @@ -65,6 +65,48 @@ static void VideoMode_Free( sf::VideoMode *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 ) { 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 ); // 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 + 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=" ); }