Strict

' an example showing how to manipulate the image that the MPEG
' is playing on
' I like to call it "70's Top of the Pops" ;-)
' - pantson

Import pantson.mpeg

Local m:Tmpeg
Local i:timage

Local r:Int
Local b:Float
Local db:Float

' bounce
db = 0.1
b = 1

' set to OpenGL if you want to.
' functions run faster in OpenGL.
' module still caters for DirectX
'SetGraphicsDriver(GLMax2DDriver())
Graphics 800,600,0

' load in movie
m = OpenMPEG("drwho.mpg")
m.autoloop = True

' create image
i = CreateImage(MPEGwidth(m),MPEGheight(m))
MidHandleImage i

' start mpeg
StartMPEG(m)

' loop until EndOfMpeg
While Not EOM(m) And Not KeyDown(key_escape)
	' if new frame	
	If DrawMPEGimage(m,i) = True
		' set rotation
		SetRotation r
		' bounce scale
		SetScale b,b
		' draw frame
		DrawImage i,400,300
		Flip
		
		' bounce
		b:+db
		If b<1 Or b>2 Then db = -db
		
		' rotation
		r:+1
	EndIf
Wend

' close
CloseMPEG(m)
End
