changing graphics modes

BlitzMax Forums/BlitzMax Beginners Area/changing graphics modes

To change graphics mode when the program is running I would assume it would be something like this...

Graphics 800,600,16,0

While Not KeyHit(KEY_ESCAPE)

	SetColor 255,255,255
	DrawText "Select graphics mode:",20,20
	DrawText "--------------------",20,40
	DrawText "1) Fullscreen mode",20,60
	DrawText "2) Windowed mode",20,80
	
	' change to fullscreen mode
	If KeyHit(KEY_1)
		EndGraphics
		FlushMem
		Graphics 800,600,16,0
	EndIf
	
	' change to windowed mode
	If KeyHit(KEY_2)
		EndGraphics
		FlushMem
		Graphics 800,600,0,0
	EndIf

	Flip
	FlushMem
	Cls
Wend
End


But if you change to windowed mode and then change back to fullscreen I get a unhandled memory exception error.

Can anybody tell me if this a bug or am I coding something wrong here?