No bug! But it is often forgotten.
When using OpenWindowedSrceen, the Windows events must always be queried as well.
Code: Select all
;-TOP
If Not InitSprite()
MessageRequester("Error", "Can't open screen & sprite environment!", 0)
End
EndIf
If Not InitKeyboard()
MessageRequester("Error", "Init keyboard faild!")
End
EndIf
If OpenWindow(0, 300, 300, 800, 600, "Spel", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600);
x = 0
Paused = #False
Repeat
; Dispatch all window events
While WindowEvent() : Wend
FlipBuffers()
ClearScreen(RGB(0, 0, 0))
If StartDrawing(ScreenOutput())
ExamineKeyboard()
If KeyboardReleased(#PB_Key_P)
If Paused = #False
Paused = #True
Else
Paused = #False
EndIf
EndIf
DrawingMode(0)
If Paused = #False
DrawText(20, 20, "Program is running...")
Else
DrawText(20, 20, "Program paused... ")
EndIf
StopDrawing()
EndIf
Until KeyboardPushed(#PB_Key_Escape)
EndIf
EndIf