## GLOBAL VARIABLES DEFAULT SETTING
set options(hostname)		localhost
set options(port)		gracer
set options(type)		{}
set options(course)		{}
set options(lap)		4
set options(condition)		Fine
set options(vehicle)		{}
set options(cachedir)		$env(HOME)/.gracer/cache
set options(use_shading)	1
set options(use_texture)	1
set options(use_mipmap)		1
set options(use_linear)		1
set options(show_sky)		1
set options(show_decr)		1
set options(audio)		1
set options(grab_keyboard)	0
set options(resx)		320
set options(resy)		240

set GRACER_HOME			/usr/local/share/gracer
set GRACER_USER			$env(HOME)/.gracer
set currnet_dialog		{}
set current_typename		{}
set current_coursename		{}
set serial			0

catch {set GRACER_USER $env(GRACER_USER)}
catch {set GRACER_HOME $env(GRACER_HOME)}

set rc_file			$GRACER_USER/setting

if [file readable $rc_file] {
  catch {source $rc_file}
}

if {$options(resx) < 300} {set width 300} else {set width $options(resx)}
if {$options(resy) < 300} {set height 300} else {set height $options(resy)}

#glut -initwindowsize $width $height

set gracer_search_path [ list $GRACER_USER/data \
			 $options(cachedir) \
			 $GRACER_HOME ]

proc save_setting {} {
  global rc_file options

  set file [open $rc_file "w"]

  foreach item [lsort [array names options *]] {
    puts $file "set options($item)	\{$options($item)\}"
  }
  close $file
}
