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:
parent
44e811ec64
commit
aa39447c26
5 changed files with 64 additions and 11 deletions
|
@ -34,16 +34,6 @@ static VALUE Music_Free( sf::Music *anObject )
|
|||
delete anObject;
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* Music.new() -> music
|
||||
*
|
||||
* Creates a new music instance.
|
||||
*/
|
||||
static VALUE Music_Initialize( int argc, VALUE *args, VALUE self )
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* music.openFromFile() -> true or false
|
||||
*
|
||||
|
@ -67,6 +57,20 @@ static VALUE Music_OpenFromFile( VALUE self, VALUE aFilename )
|
|||
}
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* Music.new() -> music
|
||||
*
|
||||
* Creates a new music instance.
|
||||
*/
|
||||
static VALUE Music_Initialize( int argc, VALUE *args, VALUE self )
|
||||
{
|
||||
if( argc > 0 )
|
||||
{
|
||||
rb_funcall2( self, rb_intern( "openFromFile" ), argc, args );
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* music.getDuration() -> float
|
||||
*
|
||||
|
@ -130,7 +134,7 @@ void Init_Music( void )
|
|||
rb_define_singleton_method( globalMusicClass, "new", Music_New, -1 );
|
||||
|
||||
// Instance methods
|
||||
rb_define_method( globalMusicClass, "initialize", Music_Initialize, 0 );
|
||||
rb_define_method( globalMusicClass, "initialize", Music_Initialize, -1 );
|
||||
rb_define_method( globalMusicClass, "openFromFile", Music_OpenFromFile, 1 );
|
||||
rb_define_method( globalMusicClass, "getDuration", Music_GetDuration, 0 );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue