#-------------------------------------------------------------------------------
#   OnStartup
#
#   This procedure is called right after application startup. Use it 
#   to initialize Nebula assigns.
#-------------------------------------------------------------------------------
proc OnStartup {} {

    puts "startup.tcl: OnStartup called"

    set oldCwd [psel]
    sel /sys/servers/file2

    # setup assigns
    set proj [.manglepath "proj:"]
    set home [.manglepath "home:"]
    
    .setassign "data"     "$proj/data/"
    .setassign "export"   "$proj/export/"  

    .setassign "shaders"				"data:shaders/"
    .setassign "renderpath"				"data:shaders/"
    .setassign "pathdata"				"data:data/pathdata/"
    .setassign "transformationdata"		"data:data/transformationdata/"
    .setassign "clipdata"				"data:data/clipdata/"
    .setassign "models"     			"data:gfxlib/"
    .setassign "scripts"    			"data:scripts/"
    .setassign "physics"    			"data:physics/"
    .setassign "meshes"     			"data:meshes/"
    .setassign "textures"   			"data:textures/"
    .setassign "anims"      			"data:anims/"
    .setassign "gfxlib"     			"data:gfxlib/"
    .setassign "lights"     			"data:lightlib/"
    .setassign "levels"     			"data:levels/"
    .setassign "sound"      			"data:audio/sfx"
    .setassign "music"      			"data:audio/music"
    .setassign "fonts"      			"data:fonts/"
	.setassign "appdata"				"$proj/data"
	.setassign "save"					"$proj/save/"
	.setassign "emotionfx"				"data:actors/"
	.setassign "plaene"					"$proj/plaene/"
	.setassign "user"					"$proj/user/"
	
	sel /sys/servers/gui
	
#   .addsystemfont "Interner Name" "Schriftart" Höhe bold italic underline
#	.addsystemfont "Font System" "fonts:albr56w.ttf" 12 1 0 0
#	.addcustomfont "Font System" "fonts:vera.ttf" "" 14 1 0 0

#	.addcustomfont "Interner Name" "fonts:filename.ttf" "" Höhe bold italic underline
#	.addsystemfont "Font Requester" "Arial Black" 17 0 0 0
#	.addcustomfont "Font Requester fett" "fonts:albr56w.ttf" "" 15 1 0 0
#	.addcustomfont "Font Requester Headline" "fonts:albr85w.ttf" "" 16 1 0 0
#	.addcustomfont "Font Requester Sheet" "fonts:albr85w.ttf" "" 14 1 0 0
#	.addsystemfont "Font App" "Arial Black" 17 0 0 0
	
	sel /app
	
	# 0 = Fenstermodus, 1 = Fullscreen
	.setfullscreen 1
	
    sel $oldCwd
}

#-------------------------------------------------------------------------------
#   OnShutdown
#   
#   This procedure is called when the application shuts down.
#-------------------------------------------------------------------------------
proc OnShutdown {} {
    puts "startup.tcl: OnShutdown called"
}

#-------------------------------------------------------------------------------
#   OnGraphicsStartup
#
#   This method is called right after graphics is initialized.
#-------------------------------------------------------------------------------
proc OnGraphicsStartup {} {

    set oldCwd [psel]
    sel /sys/servers/file2

    if {[exists /sys/servers/gfx]} {
       set featureSet [/sys/servers/gfx.getfeatureset]
       if {($featureSet == "dx9") || ($featureSet == "dx9flt")} {
           /sys/servers/scene.setrenderpathfilename "shaders:dx9_20.xml"
       } else {
           # non-DX9 hardware, use fixed function render path
         /sys/servers/scene.setrenderpathfilename "shaders:fixed.xml"
       }
    }

    sel $oldCwd
}

#-------------------------------------------------------------------------------
#   OnGraphicsShutdown
#
#   This method is called right after graphics is initialized.
#-------------------------------------------------------------------------------
proc OnGraphicsShutdown {} {
    # empty
}

#-------------------------------------------------------------------------------
#   OnMapInput
#
#   This procedure is called when input should be mapped.
#-------------------------------------------------------------------------------
proc OnMapInput {} {
} 

#-------------------------------------------------------------------------------
#   OnGuiServerOpen
#
#   This function is called when the Nebula2 GUI server is opened.
#-------------------------------------------------------------------------------
proc OnGuiServerOpen {} {
    set cwd [psel]

    # initialize the default tooltip
    set guiRoot [/sys/servers/gui.getrootpath]
    sel $guiRoot
    new nguitooltip Tooltip
        sel Tooltip
        .setdefaultbrush "tooltip"
        .setfont "GuiSmall"
        .setcolor 0 0 0 1
        .setalignment "left"
        .setborder 0.005 0.005
    sel ..

    # load system skin
    source "scripts:systemskin.tcl"
}

#-------------------------------------------------------------------------------
#   OnGuiServerClose
#
#   This function is called when the Nebula2 GUI server is closed.
#-------------------------------------------------------------------------------
proc OnGuiServerClose {} {

}


