Added a #initialize_copy method to all classes which are wrapped around a C++ object in order to properly copy the values.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1740 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
groogy 2010-12-03 19:47:41 +00:00
parent 0920da5d8e
commit bb7a6fac1f
14 changed files with 156 additions and 8 deletions

View file

@ -86,6 +86,15 @@ static VALUE View_Initialize( int argc, VALUE *args, VALUE self )
return self;
}
static VALUE View_InitializeCopy( VALUE self, VALUE aSource )
{
sf::View *object = NULL;
Data_Get_Struct( self, sf::View, object );
sf::View *source = NULL;
Data_Get_Struct( aSource, sf::View, source );
*object = *source;
}
/* call-seq:
* view.getCenter() -> vector2
*
@ -403,6 +412,7 @@ void Init_View( void )
// Instance methods
rb_define_method( globalViewClass, "initialize", View_Initialize, -1 );
rb_define_method( globalViewClass, "initialize_copy", View_InitializeCopy, 1 );
rb_define_method( globalViewClass, "setCenter", View_SetCenter, -1 );
rb_define_method( globalViewClass, "setSize", View_SetSize, -1 );
rb_define_method( globalViewClass, "setRotation", View_SetRotation, 1 );