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

@ -237,6 +237,15 @@ static VALUE SoundSource_SetVolume( VALUE self, VALUE aValue )
return Qnil;
}
static VALUE SoundSource_InitializeCopy( VALUE self, VALUE aSource )
{
sf::SoundSource *object = NULL;
Data_Get_Struct( self, sf::SoundSource, object );
sf::SoundSource *source = NULL;
Data_Get_Struct( aSource, sf::SoundSource, source );
*object = *source;
}
static void DefineStatusEnum( void )
{
rb_define_const( globalSoundSourceClass, "Stopped", INT2FIX( sf::SoundSource::Stopped ) );
@ -260,6 +269,7 @@ void Init_SoundSource( void )
DefineStatusEnum();
// Instance methods
rb_define_method( globalSoundSourceClass, "initialize_copy", SoundSource_InitializeCopy, 1 );
rb_define_method( globalSoundSourceClass, "getAttenuation", SoundSource_GetAttenuation, 0 );
rb_define_method( globalSoundSourceClass, "getMinDistance", SoundSource_GetMinDistance, 0 );
rb_define_method( globalSoundSourceClass, "getPitch", SoundSource_GetPitch, 0 );