Changed resource classes initialize method to call often used methods if arguments are provided.

Check for details: http://tasks.groogy.se/index.php?do=details&task_id=1&project=2

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1745 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
groogy 2010-12-04 19:26:05 +00:00
parent 44e811ec64
commit aa39447c26
5 changed files with 64 additions and 11 deletions
bindings/ruby/sfml-graphics/graphics

View file

@ -215,6 +215,16 @@ static VALUE Shader_Unbind( VALUE self )
return Qnil;
}
static VALUE Shader_Initialize( int argc, VALUE *args, VALUE self )
{
if( argc > 0 )
{
rb_funcall2( self, rb_intern( "loadFromFile" ), argc, args );
}
return self;
}
static VALUE Shader_InitializeCopy( VALUE self, VALUE aSource )
{
sf::Shader *object = NULL;
@ -325,6 +335,7 @@ void Init_Shader( void )
rb_define_const( globalShaderClass, "CurrentTexture", CreateCurrentTextureWrapper() );
// Instance methods
rb_define_method( globalShaderClass, "initialize", Shader_Initialize, -1 );
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 );