/*
 *  call-seq:
 *    Surface.autoload( filename )  ->  Surface or nil
 *
 *  Searches each directory in Surface.autoload_dirs for a file with
 *  the given filename. If it finds that file, loads it and returns
 *  a Surface instance. If it doesn't find the file, returns nil.
 *
 *  See Rubygame::NamedResource for more information about this
 *  functionality.
 *
 */
VALUE rbgm_image_autoload( VALUE class, VALUE namev )
{
  VALUE pathv = rb_funcall( class, rb_intern("find_file"), 1, namev );

  if( RTEST(pathv) )
  {
    return rbgm_image_load( class, pathv );
  }
  else
  {
    return Qnil;
  }
}