Capturing Max window to video example

BlitzMax Forums/BlitzMax Programming/Capturing Max window to video example

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi. Just a quick update on what I'm working on.
You can give it a window handle, and then just dump it to an AVI using most installed codecs.

Output example here: http://www.furi.dk/files/AVIWriteTest.avi
(714k/Intel Indeo 5 codec so all can use it)
' Include AVITool
Include "AVITool.bmx"

' Create AVI Writer class
Global AVIWriter:TAVIWriter = New TAVIWriter

' Never forget this one
If (Not AVITool_Init())

	Notify("Failed to init AVITool! See debug log for more info.")
	Return

End If

' Setup windowed graphics
Graphics 640,480

' HWND comes from DirectX. TODO: Fix to work in GL mode too.
Local hWnd:Int = Primarydevice.hwnd

' Init AVI writer
If (Not AVIWriter.Open("test.avi", 640, 480, 60, hWnd))

	Notify("Failed to open file for writing!")
	Return

End If


' Loop until escape, recording every step of the way
While(Not KeyHit(KEY_ESCAPE))
	
	' Random square color
	SetColor(Rand(0,255), Rand(0,255), Rand(0,255))
	
	' Random square
	DrawRect(Rand(0, 640), Rand(0, 480),10,10)
	
	' Set white color for text
	SetColor(255,255,255)
	
	' Draw text
	DrawText("Hello this!", Rand(0, 640), Rand(0, 480))
		
	' Update screen
	Flip()
	
	' Write to AVI
	AVIWriter.WriteFrame()

Wend

' Close AVI writer. Never forget this or file will be corrupt.
AVIWriter.Close()