/* call-seq:
 *   ContextSettings.new( depth = 24, stencil = 8, antialiasing = 0, major = 2, minor = 0)      -> settings
 *
 * The constructor creates the settings
 */
static VALUE ContextSettings_New( VALUE aKlass, VALUE someArgs )
{
        long arrayLength = RARRAY_LEN( someArgs );     
        sf::ContextSettings *object = NULL;
        if( arrayLength == 0 )
        {
                object = new sf::ContextSettings();
        }
        else if( arrayLength == 1 )
        {
                VALUE arg1 = rb_ary_entry( someArgs, 0 );
                object = new sf::ContextSettings( NUM2UINT( arg1 ) );
        }
        else if( arrayLength == 2 )
        {
                VALUE arg1 = rb_ary_entry( someArgs, 0 );
                VALUE arg2 = rb_ary_entry( someArgs, 1 );
                object = new sf::ContextSettings( NUM2UINT( arg1 ), NUM2UINT( arg2 ) );
        }
        
        else if( arrayLength == 3 )
        {
                VALUE arg1 = rb_ary_entry( someArgs, 0 );
                VALUE arg2 = rb_ary_entry( someArgs, 1 );
                VALUE arg3 = rb_ary_entry( someArgs, 2 );
                object = new sf::ContextSettings( NUM2UINT( arg1 ), NUM2UINT( arg2 ), NUM2UINT( arg3 ) );
        }
        else if( arrayLength == 4 )
        {
                VALUE arg1 = rb_ary_entry( someArgs, 0 );
                VALUE arg2 = rb_ary_entry( someArgs, 1 );
                VALUE arg3 = rb_ary_entry( someArgs, 2 );
                VALUE arg4 = rb_ary_entry( someArgs, 3 );
                object = new sf::ContextSettings( NUM2UINT( arg1 ), NUM2UINT( arg2 ), NUM2UINT( arg3 ), NUM2UINT( arg4 ) );
        }
        else if( arrayLength == 5 )
        {
                VALUE arg1 = rb_ary_entry( someArgs, 0 );
                VALUE arg2 = rb_ary_entry( someArgs, 1 );
                VALUE arg3 = rb_ary_entry( someArgs, 2 );
                VALUE arg4 = rb_ary_entry( someArgs, 3 );
                VALUE arg5 = rb_ary_entry( someArgs, 4 );
                object = new sf::ContextSettings( NUM2UINT( arg1 ), NUM2UINT( arg2 ), NUM2UINT( arg3 ), NUM2UINT( arg4 ), NUM2UINT( arg5 ) );
        }
        else
        {
                rb_raise( rb_eArgError, "Expected 0..5 arguments but was given %ld", arrayLength );
                return Qnil;
        }
         
        VALUE rbData = Data_Wrap_Struct( aKlass, 0, ContextSettings_Free, object );
        rb_obj_call_init( rbData, 0, 0 );
        return rbData;
}