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:
parent
0920da5d8e
commit
bb7a6fac1f
14 changed files with 156 additions and 8 deletions
|
@ -42,6 +42,15 @@ static VALUE Glyph_Initialize( VALUE self )
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE Glyph_InitializeCopy( VALUE self, VALUE aSource )
|
||||
{
|
||||
sf::Glyph *object = NULL;
|
||||
Data_Get_Struct( self, sf::Glyph, object );
|
||||
sf::Glyph *source = NULL;
|
||||
Data_Get_Struct( aSource, sf::Glyph, source );
|
||||
*object = *source;
|
||||
}
|
||||
|
||||
void Init_Glyph( void )
|
||||
{
|
||||
/* SFML namespace which contains the classes of this module. */
|
||||
|
@ -58,6 +67,10 @@ void Init_Glyph( void )
|
|||
*/
|
||||
globalGlyphClass = rb_define_class_under( sfml, "Glyph", rb_cObject );
|
||||
|
||||
// Instance methods
|
||||
rb_define_method( globalGlyphClass, "initialize", Glyph_Initialize, 0 );
|
||||
rb_define_method( globalGlyphClass, "initialize_copy", Glyph_InitializeCopy, 1 );
|
||||
|
||||
// Attribute accessors
|
||||
rb_define_attr( globalGlyphClass, "advance", 1, 1 );
|
||||
rb_define_attr( globalGlyphClass, "bounds", 1, 1 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue