; DrawMovie Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Copy a video file called my_movie.avi next to this .bb file to see ; this example play it - Blitz3D+ ships no video of its own. movie_file$="my_movie.avi" found=0 If FileType(movie_file)=1 Then found=1 Cls Text 0,0,"DrawMovie draws the next frame of a movie into the current buffer." Text 0,40,"Looking for "+movie_file+" in this example's folder" If found Then Text 0,60,"Found it." Else Text 0,60,"Not there - copy a video file in under that name to see it play." End If Text 0,100,"Press and hold Y to open it, or any other key to skip" Flip WaitKey movie=0 If KeyDown(21) And found Then movie=OpenMovie(movie_file) ; 1 = own size, 2 = half size, 3 = stretched to fill the window preset=1 spin#=0 While Not KeyDown(1) Cls ; Number keys pick the destination rectangle If KeyHit(2) Then preset=1 If KeyHit(3) Then preset=2 If KeyHit(4) Then preset=3 If movie<>0 Then w=MovieWidth(movie) h=MovieHeight(movie) If preset=2 Then w=w/2 h=h/2 End If If preset=3 Then w=600 h=340 End If ; One frame per call. The return value is 1 while there are ; frames left and 0 once the movie has run out. playing=DrawMovie(movie,20,100,w,h) Text 0,40,"DrawMovie movie,20,100,"+w+","+h+" returned "+playing Text 0,60,"Leave w and h out and it draws at "+MovieWidth(movie)+" x "+MovieHeight(movie) Else spin=spin+3 Color 90,120,190 Rect 300+Cos(spin)*70,240+Sin(spin)*70,24,24,1 Color 255,255,255 Text 0,40,"No movie open, so there is nothing for DrawMovie to draw." Text 0,60,"It needs a handle from OpenMovie - never pass it 0." End If Text 0,0,"1: own size 2: half size 3: stretch Esc: exit" Flip Wend If movie<>0 Then CloseMovie movie End