?Win32
SetAudioDriver "directsound"
?MacOS
SetAudioDriver "freeaudio"
?


' ------------------------------------------------------------------------------------------------
' Init Graphics
' ------------------------------------------------------------------------------------------------
AppTitle = "Extrasolar " + Round(GAME_VERSION, 3)
GLShareContexts()



AppTitle = "Starmap Demo by Krischan [www.extrasolar.de]"

Global swidth:Int = 1024
Global sheight:Int = 600
Global sfull:Int = 2
Global secx:Int = 127
Global secy:Int = 177

If AppArgs.length > 1 Then

	If Int(AppArgs[1]) > 0 Then swidth = Int(AppArgs[1])

End If

If AppArgs.length > 2 Then

	If Int(AppArgs[2]) > 0 Then sheight = Int(AppArgs[2])

End If

If AppArgs.length > 3 Then

	If Int(AppArgs[3]) > 0 Then sfull = 1 Else sfull = 2

End If

If AppArgs.length > 4 Then

	If Int(AppArgs[4]) > 0 Then secx = Int(AppArgs[4])

End If

If AppArgs.length > 5 Then

	If Int(AppArgs[5]) > 0 Then secy = Int(AppArgs[5])

End If

'Graphics3D SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SCREEN_MODE
Graphics3D swidth, sheight, SCREEN_DEPTH, sfull
ClearTextureFilters()

'HideMouse()
'WaitKey()

' ------------------------------------------------------------------------------------------------
' Main loop
' ------------------------------------------------------------------------------------------------
InitGame()

While Not AppTerminate()

	' Timed VSYC loop
	MainLoop()
	
	' 3D Output
	Wireframe FLAG.Get("WIREFRAME")
	
	'Delay 10
	
	RenderWorld
	FPS.Update()
	
	' 2D output
	GUI()
	
	Delay 1

	' Bufferflip
	Flip FLAG.Get("VSYNC")

	' Memory Garbage Collection
	'GCCollect()

Wend

EndGraphics

End