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

@ -130,6 +130,15 @@ static VALUE Font_GetImage( VALUE self, VALUE aCharacterSize )
return rbImage;
}
static VALUE Font_InitializeCopy( VALUE self, VALUE aSource )
{
sf::Font *object = NULL;
Data_Get_Struct( self, sf::Font, object );
sf::Font *source = NULL;
Data_Get_Struct( aSource, sf::Font, source );
*object = *source;
}
/* call-seq:
* Font.new() -> font
*
@ -219,6 +228,7 @@ void Init_Font( void )
rb_define_singleton_method( globalFontClass, "getDefaultFont", Font_GetDefaultFont, 0 );
// Instance methods
rb_define_method( globalFontClass, "initialize_copy", Font_InitializeCopy, 1 );
rb_define_method( globalFontClass, "loadFromFile", Font_LoadFromFile, 1 );
rb_define_method( globalFontClass, "getGlyph", Font_GetGlyph, 3 );
rb_define_method( globalFontClass, "getKerning", Font_GetKerning, 3 );