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

@ -152,6 +152,15 @@ static VALUE VideoMode_IsValid( VALUE self )
return ( object->IsValid() == true ? Qtrue : Qfalse );
}
static VALUE VideoMode_InitializeCopy( VALUE self, VALUE aSource )
{
sf::VideoMode *object = NULL;
Data_Get_Struct( self, sf::VideoMode, object );
sf::VideoMode *source = NULL;
Data_Get_Struct( aSource, sf::VideoMode, source );
*object = *source;
}
/* call-seq:
* VideoMode.getDesktopMode -> desktop_mode
*
@ -260,6 +269,8 @@ void Init_VideoMode( void )
rb_define_singleton_method( globalVideoModeClass, "getFullscreenModes", VideoMode_GetFullscreenModes, 0 );
// Instance methods
rb_define_method( globalVideoModeClass, "initialize_copy", VideoMode_InitializeCopy, 1 );
rb_define_method( globalVideoModeClass, "width", VideoMode_GetWidth, 0 );
rb_define_method( globalVideoModeClass, "width=", VideoMode_SetWidth, 1 );