; PROJECT : Wolf3D
; EDITED  : 8/3/2007
; ---------------------------------------------------------------------
 



	


Function ShowIntro(Filename$)
	Title=getfreeimage()
 	LoadFXimage Filename$,Title


	FadeRate#=1000/255
	FadeLevel=255	

	Spr=newSprite(GetScreenWidth()/2,GetScreenHeight()*0.35,Title)
	CenterSPritehandle spr
	SpriteDrawmode Spr, 2+2048

	Level#=0.95
		
	SpriteAlphaLevel spr,Level#
	SpriteAlphaCOlour spr,rgb(0,0,0)

	IntroStartTime=timer()
	IntroEndTime=IntroStartTime+5000

	rendertoimage Title
	
	BackDropColour=point(0,0)

	CurrentColour=BackDropColour
	rendertoScreen

	TextColour=Rgb(0,50,120)

	StartTime=Timer()
	
	Repeat

		Time=timer()	
	
		if fade=false	
			if Spacekey() or Mousebutton() or time>IntroEndTime
				fade=true
				FadeStartTime	=timer()
				FadeENDTime		=FadeStartTime+1000		
			endif	
		endif

		; Check if fade out is active
		if Fade=true
			Level#=(Time-FadeStartTime)/1000.0
			Level#=1-Level#
			if Level#<0 then Level#=0
			if Level#>0.95 then Level#=0.95
		endif

		SpriteAlphaLevel Spr,Level#
		CurrentColour=RgbAlphaBlend(0,BackDropColour,Level#*100)			


		Cls CurrentColour
		DrawAllSprites


		; Instuctions
	
		y =GetSpriteY(Spr)+(GetImageHeight(Title)/2)+20
		th=20
		x=GetScreenWidth()/2

		ink RgbAlphaBlend(0,TextColour,(Level#)*100)			
		CenterText X,y,"[ "+Program_Title$+" ]" : y=y+th+(th/2)
		CenterText X,y,"By Kevin Picone" : y=y+th+(th/2)

			x2=x-220
			Text X2,y,"Controls:" : y=y+th+(th/2)
			yh=th

			x=x2+100
	  		text x,y,"Arrow Keys = Control Camera " : Y=y+yh
	  		text x,y,"        M  = Toggle Mip Maps" : Y=y+yh
	  		text x,y,"    Space  = Add Wall Segments" : Y=y+yh
	  		text x,y,"       ESC = Quit" : Y=y+yh

		Sync
	Until Fade=true and time>FadeEndTime

	DeleteSprite Spr
	DeleteImage Title 
	Ink rgb(255,255,255)

EndFunction


 
