' ------------------------------------------------------------------------------------------------
' Experimental: ReInit Graphics during game
' ------------------------------------------------------------------------------------------------
Function ReInit(width:Int, height:Int, depth:Int, mode:Int)

	TIME.Start()

	' recalculate mouse position in New resolution
	Local MouseX_old:Int = MouseX()
	Local MouseY_old:Int = MouseY()
	Local MouseX_new:Int = Normalize(MouseX_old, 0, SCREEN_WIDTH, 0, width, True)
	Local MouseY_new:Int = Normalize(MouseY_old, 0, SCREEN_HEIGHT, 0, height, True)

	Local ModeString:String[] = ["", "Fullscreen", "Window"]
	
	' delete current Camera
	FreeEntity CAMERA.cam

	' reset globals
	SCREEN_WIDTH = width
	SCREEN_HEIGHT = height
	SCREEN_DEPTH = depth
	SCREEN_MODE = mode

	' re-initialize Graphics mode
	Graphics3D SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SCREEN_MODE

	' re-create camera
	CAMERA.Add()
	CAMERA.width = SCREEN_WIDTH
	CAMERA.height = SCREEN_HEIGHT
	CAMERA.Update()
	
	' move mouse To "old" position
	MoveMouse MouseX_new, MouseY_new

	TIME.Stop("Screen resolution to " + width + "x" + height + " (" + ModeString[mode] + ") change complete")

End Function

' ------------------------------------------------------------------------------------------------
' Hides all known Modules
' ------------------------------------------------------------------------------------------------
Function HideModules()

	STARMAP._Hide()
	
End Function

Function SystemInfo()
	
	INFO.Add("FPS/Avg/Drops.: " + FPS.FPS + "/" + FPS.averagefps + "/" + FPS.framedrops)
	INFO.Add("Memory Usage..: " + Int(FPS.Memory / 1024) + "K")
	INFO.Add("MEDIA Size....: " + Int(MEDIA.totalsize / 1048576) + "M")
	INFO.Add("Initialization: " + TIME.totaltime + "ms")
	INFO.Add("Loop TIME.....: " + FPS.looptime + "ms")
	INFO.Add("VSYNC.........: " + Switch[FLAG.Get("VSYNC")])
	INFO.Add("Wireframe.....: " + Switch[FLAG.Get("Wireframe")])
	INFO.Add("Seed..........: " + GAME_SEED)

End Function