image slide show

Blitz3D Forums/Blitz3D Beginners Area/image slide show

A little better...

Graphics3D 800,600,16

SetBuffer BackBuffer()
 

Const	NOF_SLIDES = 3; 	Change this to how many pics you have

Dim images$(NOF_SLIDES)
Dim slides(NOF_SLIDES)

images$(0) = "Dm1.png"
images$(1) = "Dm2.png"
images$(2) = "Dm3.png"


Global index=0;
Global timer=0;

; Load before main loop

InitialiseSlideShow()

; -------------------
; Main program
; -------------------

timer = MilliSecs();

While Not KeyHit(1)

	Cls
	
	UpdateSlides(500) 

	ShowSlides(index)	

	Flip     

Wend

End


; - Functions here on in -

; ------------------------------
; Load images on initialisation.
; ------------------------------

Function InitialiseSlideShow()

	index = 0;

	While(index < NOF_SLIDES)
		slides(index) = LoadImage( images$(index) )
		index=index+1;
	Wend

	index =0;

End Function


; -----------------------
; Update the slide index when timer has elapsed
; -----------------------

Function UpdateSlides( wait_time )

	; Check that the tiime has elapsed before updating image.
	If(MilliSecs() < (timer + wait_time)) Return;		

	timer=MilliSecs()

	If (index < NOF_SLIDES-1) Then  
		index=index+1
	Else
		index=0;
	EndIf 

End Function

; -----------------------
; Show the current slide
; -----------------------

Function ShowSlides( idx )

	DrawImage(slides(idx), 0, 0 );
	
End Function



Hope this helps...