If i resize the window by grabbing the bottom window border then the y-position of the screen inside the window gets messed up. making the window larger is shifting the screen upwards and making it smaller shifts it downwards, or at least that's how it looks like.
PureBasic 5.60 (Linux - x64), Ubuntu 16.04.2 LTS.
i did not test it with Windows.
Code: Select all
If InitSprite() = 0
MessageRequester("Error", "Can't open screen & sprite environment!", 0)
End
EndIf
If OpenWindow(0, 0, 0, 420, 200, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
CreateStatusBar(0, WindowID(0))
AddStatusBarField(420)
StatusBarText(0, 0, "Automatically zoomed screen area when changing window size...")
If OpenWindowedScreen(WindowID(0), 0, 0, 420, 200, #True, 0, 20)
CreateSprite(0, 50, 50) ; Create an empty sprite, will be whole black
Repeat
; It's very important to process all the events remaining in the queue at each frame
;
Repeat
Event = WaitWindowEvent(10)
If Event = #PB_Event_CloseWindow
End
EndIf
Until Event = 0
FlipBuffers()
ClearScreen(RGB(0, 0, 200)) ; A blue background
DisplaySprite(0, 10, 10) ; Display our black box at the left-top corner
DisplaySprite(0, 260, 10) ; Display our black box at the right-top corner
StartDrawing(ScreenOutput())
StopDrawing()
ForEver
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
EndIf
EndIf