SetViewPort

BlitzMax Forums/BlitzMax Programming/SetViewPort

About GFK's code.
When I tried to run it, but in OpenGL it won't run at all on the Windows machine I'm currently using. And since OpenGL is not exactly a standard in Windows (as I heard MicroSoft announced), I cannot take for granted the users of my project will have it installed. (I don't know where to get a Windows Version of OpenGL either, and since I expect my windows-users to be DX users, I've not too much interest for that either)

Tony's code is a good code to keep in mind.
It's too slow for real-time usage, that I could see without using it, but the idea is not that bad.

I've now solved the problem by altering the code this way:
Function BattleMessage(Msg$)
Local MS1 = MilliSecs()
Local MS2
?Win32
'Make picture of original screen to cover a bug in Windows
Local Ori:TImage = CreateImage(800,500)
GrabImage Ori,0,100
?
Repeat
battleDrawScreen
DrawImage BXTop,0,20-ImageHeight(BXTop)
SetViewport 0,20,800,80
SetOrigin 0,20
TileImage BxBody,0,0
SetScale 2,2
SetColor BXR,BXG,BXB
DrawText MSG,400-(TextWidth(MSG)),40-(TextHeight(MSG))
SetScale 1,1
SetColor 255,255,255
SetOrigin 0,0
SetViewport 0,0,800,600
?Win32
'Project the picture To hide the bug in Windows
SetColor 0,0,0
DrawRect 0,100,800,500
SetColor 255,255,255
DrawImage Ori,0,100
?
DrawImage BXBottom,0,100
Flip
MS2=MilliSecs()
Until MS2<MS1 Or MS2-MS1>5000
End Function


I know you'll bash this solution.
And I would not have used this solution, if this project wasn't part of a multi-project. But it works and the user won't see the difrence.