Got some code to duplicate the problem, you need a title.jpg and a paused.png to replicate it yourself:
Strict
Extern "win32"
Function GetActiveWindow%()
End Extern
Graphics 800,600,32
Const SW_MINIMIZE = 6 'used with ShowWindow
Global WindowHandle = GetActiveWindow() 'need this to set icon, even in full screen mode.
Global image:TImage = LoadImage("Title.jpg")
Global paused:TImage = LoadImage("paused.png")
'DrawImage(Paused,200,200) 'uncomment this and crash will not occur
While Not KeyHit(Key_ESCAPE)
Cls
SetBlend SOLIDBLEND
DrawImage image,0,0
DrawText "Press Escape to Exit",10,10
DrawText "Press M to Minimise",10,30
SetBlend ALPHABLEND
If AppSuspended() Then
DrawImage(Paused,200,200)
EndIf
Flip
If KeyHit(Key_M) Then
ccMinimiseWindow(WindowHandle)
EndIf
Wend
' -----------------------------------------------------------------------------
' ccMinimiseWindow: Windows API call to minimise a window
' -----------------------------------------------------------------------------
Function ccMinimiseWindow(hWnd%)
?Win32
ShowWindow(hWnd, SW_MINIMIZE)
?
EndFunction
I've figured out what's happening. When the game is suspended the code tries to draw Paused on the screen. Because Paused has NOT been sent to VRAM yet, the first time it tries to draw DX generates an error because the game is not longer full-screen it's minimised. If you uncomment the 'DrawImage(Paused,200,200) near the top, this sends Paused to VRAM and then later when the game tries to draw Paused when the game is minimised it works fine.
Basically DX (or BMax's implementation of DX) doesn't like it if you sent a graphic to VRAM when the game is minimised in this fashion. But it handles it if the game is alt+tabbed or Windows key is pressed. Some other Windows apps sometimes force a game to minimise when they have completed some task, I've seen this, and maybe they'll crash out the video driver in such a case.
Of the 800+ people that beta tested my latest game some of them did get some weird behaviour after the game had been running for a while, something about a severe driver error (windows error dialog). Wonder if it was caused by this?
Sure I could fix it my end by ensuring that no NEW graphics are drawn when the game is suspended but as this works in OpenGL it would be nice if it worked in DX.
Shall I post it in the bug forum?
|