From 44e811ec64a948e788e8455c84fc0e7452b94d98 Mon Sep 17 00:00:00 2001 From: groogy Date: Sat, 4 Dec 2010 18:01:32 +0000 Subject: [PATCH] Fixed a bug in RenderImage where RenderImage_GetHeight was named RenderTarget_GetHeight which should've led to that you couldn't even compile the source. Also added so that when creating a new RenderImage instance that if you give any arguments then those will be passed on to a method call to SFML::RenderImage#create. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1744 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/ruby/sfml-graphics/graphics/RenderImage.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp b/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp index 37f24e3b..1d611728 100644 --- a/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp +++ b/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp @@ -276,13 +276,22 @@ static VALUE RenderImage_GetWidth( VALUE self ) return INT2FIX( object->GetWidth() ); } -static VALUE RenderTarget_GetHeight( VALUE self ) +static VALUE RenderImage_GetHeight( VALUE self ) { sf::RenderImage *object = NULL; Data_Get_Struct( self, sf::RenderImage, object ); return INT2FIX( object->GetHeight() ); } +static VALUE RenderImage_Initialize( int argc, VALUE *args, VALUE self ) +{ + if( argc > 0 ) + { + rb_funcall2( self, rb_intern( "create" ), argc, args ); + } + return self; +} + /* call-seq: * RenderImage.new() -> render_image * @@ -383,6 +392,7 @@ void Init_RenderImage( void ) rb_define_singleton_method( globalRenderImageClass, "isAvailable", RenderImage_IsAvailable, 0 ); // Instance methods + rb_define_method( globalRenderImageClass, "initialize", RenderImage_Initialize, -1 ); rb_define_method( globalRenderImageClass, "draw", RenderImage_Create, -1 ); rb_define_method( globalRenderImageClass, "create", RenderImage_Create, -1 ); rb_define_method( globalRenderImageClass, "display", RenderImage_Display, 0 );