I was making a tutorial (small one) to submit and ran into an amusing bug.
If you call ScreenGrab from within your game, you will notice something, GetImage is passed in your game screen width and height properly (in my case 800x600), but SaveImage always saves as a 1024x1024 no matter what the GetImage has in it.
Same goes for GetImageB no matter what you set the texture flag to.
Yea, I originally had the code as
oDBImage.GetImage(99999, 0, 0, oDBDisplay.ScreenWidth, oDBDisplay.ScreenHeight)
Added in the Dim statements to show that it didn't matter.
I'll add this code, with it modified back up in the article thread.
Friend Sub ScreenGrab()
Try
Dim tmpWidth As Integer
Dim tmpHeight As Integer
tmpWidth = oDBDisplay.ScreenWidth
tmpHeight = oDBDisplay.ScreenHeight
oDBImage.GetImage(99999, 0, 0, tmpWidth, tmpHeight)
oDBImage.SaveImage("ScreenCapture_" & fixString(Now.ToString) & ".jpg", 99999)
oDBImage.DeleteImage(99999)
Catch ex As Exception
LogError("modShared.ScreenGrab()", Now.ToString, ex.ToString)
End Try
End Sub
Private Function fixString(ByVal inString As String) As String
Dim tmpReturn As String
tmpReturn = Replace(inString, "/", "_")
tmpReturn = Replace(tmpReturn, "\", "_")
tmpReturn = Replace(tmpReturn, ":", "_")
tmpReturn = Replace(tmpReturn, "*", "_")
tmpReturn = Replace(tmpReturn, "?", "_")
tmpReturn = Replace(tmpReturn, "<", "_")
tmpReturn = Replace(tmpReturn, ">", "_")
tmpReturn = Replace(tmpReturn, "|", "_")
tmpReturn = Replace(tmpReturn, " ", "_")
Return tmpReturn
End Function