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

View file

@ -130,6 +130,15 @@ static VALUE Font_GetImage( VALUE self, VALUE aCharacterSize )
return rbImage;
}
static VALUE Font_Initialize( int argc, VALUE *args, VALUE self )
{
if( argc > 0 )
{
rb_funcall2( self, rb_intern( "loadFromFile" ), argc, args );
}
return self;
}
static VALUE Font_InitializeCopy( VALUE self, VALUE aSource )
{
sf::Font *object = NULL;
@ -228,6 +237,7 @@ void Init_Font( void )
rb_define_singleton_method( globalFontClass, "getDefaultFont", Font_GetDefaultFont, 0 );
// Instance methods
rb_define_method( globalFontClass, "initialize", Font_Initialize, -1 );
rb_define_method( globalFontClass, "initialize_copy", Font_InitializeCopy, 1 );
rb_define_method( globalFontClass, "loadFromFile", Font_LoadFromFile, 1 );
rb_define_method( globalFontClass, "getGlyph", Font_GetGlyph, 3 );