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
|
@ -214,6 +214,16 @@ static VALUE Event_Initialize( VALUE self, VALUE aType )
|
|||
}
|
||||
}
|
||||
|
||||
static VALUE Event_InitializeCopy( VALUE self, VALUE aSource )
|
||||
{
|
||||
sf::Event *object = NULL;
|
||||
Data_Get_Struct( self, sf::Event, object );
|
||||
sf::Event *source = NULL;
|
||||
Data_Get_Struct( aSource, sf::Event, source );
|
||||
*object = *source;
|
||||
return Event_Initialize( VALUE self, INT2FIX( object->Type ) );
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* Event.new(type) -> event
|
||||
*
|
||||
|
@ -230,7 +240,6 @@ static VALUE Event_New( int argc, VALUE * args, VALUE aKlass )
|
|||
return rbData;
|
||||
}
|
||||
|
||||
|
||||
void Init_Event( void )
|
||||
{
|
||||
/* SFML namespace which contains the classes of this module. */
|
||||
|
@ -302,6 +311,8 @@ void Init_Event( void )
|
|||
|
||||
// Instance methods
|
||||
rb_define_method( globalEventClass, "initialize", Event_Initialize, 1 );
|
||||
rb_define_method( globalEventClass, "initialize_copy", Event_InitializeCopy, 1 );
|
||||
|
||||
rb_define_attr( globalEventClass, "type", 1, 0 );
|
||||
rb_define_attr( globalEventClass, "joyButton", 1, 0 );
|
||||
rb_define_attr( globalEventClass, "joyMove", 1, 0 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue