Rem Project: Crystal
Rem Created: Saturday, December 12, 2020

Rem ***** Main Source File *****

	
	`Set Up Display
	Sw=desktop width() 
	Sh=desktop height()
	set display mode Sw,Sh,32,1
	sync on : sync rate 0
	hide mouse
	
	load object "terrain.x",1
	load effect "Crystal_v01.fx",1,0
	set object effect 1,1
	set object transparency 1,2

	CamDis#=-100
	
	`Start loop
	do

	`Control Camera
	position camera 0,0,0
	if mouseclick()=0
	xrotate camera camera angle x()-mousemovey()*0.25
	yrotate camera camera angle y()+mousemovex()*0.25
	if camera angle x()>80 then xrotate camera 80
	if camera angle x()<-60 then xrotate camera -60
	endif
	if mouseclick()>0 then CamDis#=CamDis#-mousemovey()*0.25
	CamDis#=CamDis#+mousemovez()*0.25
	if upkey()=1 then CamDis#=CamDis#+2.5
	if downkey()=1 then CamDis#=CamDis#-2.5
	if CamDis#>-20 then CamDis#=-20
	if CamDis#<-300 then CamDis#=-300
	move camera CamDis#
	if camera position y()<-60 then position camera camera position x(),-60,camera position z()
	
	mousemovex()=0
	mousemovey()=0
	
	if keystate(2)=1 then set effect technique 1,"FlatColor1"
	if keystate(3)=1 then set effect technique 1,"FlatColor2"
	if keystate(4)=1 then set effect technique 1,"FlatColor3"
		
	fastsync
	loop
