/* call-seq: * window.create( mode, title, style = SFML::Style::Default, settings = SFML::ContextSettings.new ) * * Create (or recreate) the window. * * If the window was already created, it closes it first. If style contains Style::Fullscreen, * then mode must be a valid video mode. */ static VALUE Window_Create( int argc, VALUE *args, VALUE self ) { sf::Window *object = NULL; sf::VideoMode *mode = NULL; sf::ContextSettings *settings = NULL; VALUE arg0 = Qnil; Data_Get_Struct( self, sf::Window, object ); switch( argc ) { case 2: arg0 = VideoMode_ForceType( args[0] ); VALIDATE_CLASS( arg0, globalVideoModeClass, "first" ); VALIDATE_CLASS( args[1], rb_cString, "second" ); Data_Get_Struct( arg0, sf::VideoMode, mode ); object->Create( *mode ,rb_string_value_cstr( &args[1] ) ); break; case 3: arg0 = VideoMode_ForceType( args[0] ); VALIDATE_CLASS( arg0, globalVideoModeClass, "first" ); VALIDATE_CLASS( args[1], rb_cString, "second" ); VALIDATE_CLASS( args[2], rb_cFixnum, "third" ); Data_Get_Struct( arg0, sf::VideoMode, mode ); object->Create( *mode, rb_string_value_cstr( &args[1] ), FIX2UINT( args[2] ) ); break; case 4: arg0 = VideoMode_ForceType( args[0] ); VALIDATE_CLASS( arg0, globalVideoModeClass, "first" ); VALIDATE_CLASS( args[1], rb_cString, "second" ); VALIDATE_CLASS( args[2], rb_cFixnum, "third" ); VALIDATE_CLASS( args[3], globalContextSettingsClass, "fourth" ); Data_Get_Struct( arg0, sf::VideoMode, mode ); Data_Get_Struct( args[3], sf::ContextSettings, settings ); object->Create( *mode, rb_string_value_cstr( &args[1] ), FIX2UINT( args[2] ), *settings ); break; default: rb_raise( rb_eArgError, "Expected 2..4 arguments but was given %d", argc ); break; } return Qnil; }