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

@ -215,6 +215,15 @@ static VALUE Shader_Unbind( VALUE self )
return Qnil;
}
static VALUE Shader_InitializeCopy( VALUE self, VALUE aSource )
{
sf::Shader *object = NULL;
Data_Get_Struct( self, sf::Shader, object );
sf::Shader *source = NULL;
Data_Get_Struct( aSource, sf::Shader, source );
*object = *source;
}
/* call-seq:
* Shader.new()
*
@ -316,6 +325,7 @@ void Init_Shader( void )
rb_define_const( globalShaderClass, "CurrentTexture", CreateCurrentTextureWrapper() );
// Instance methods
rb_define_method( globalShaderClass, "initialize_copy", Shader_InitializeCopy, 1 );
rb_define_method( globalShaderClass, "loadFromFile", Shader_LoadFromFile, 1 );
rb_define_method( globalShaderClass, "loadFromMemory", Shader_LoadFromMemory, 1 );
rb_define_method( globalShaderClass, "setParameter", Shader_SetParameter, -1 );