Time traveling balls.
Posted: Fri Mar 20, 2020 12:44 pm
Why does this program behave differently on OSX and Windows when spacebar is pressed?
On Windows the balls resume on the expected path.
On OSX the balls appear to leap forward in time.
Is there a way to make balls behave the same way on both OS?
Using PureBasic 5.72 Beta 2 for MacOS X (64-bit) on Catalina 10.15.3
and PureBasic 5.72 Beta 2 for Windows (64-bit) on Win10x64
On Windows the balls resume on the expected path.
On OSX the balls appear to leap forward in time.
Is there a way to make balls behave the same way on both OS?
Using PureBasic 5.72 Beta 2 for MacOS X (64-bit) on Catalina 10.15.3
and PureBasic 5.72 Beta 2 for Windows (64-bit) on Win10x64
Code: Select all
If InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Error", "Sprite system can't be initialized", 0)
End
EndIf
If OpenWindow(0, 0, 0, 800, 600, "", #PB_Window_BorderLess | #PB_Window_ScreenCentered) = 0
MessageRequester("Error", "Can't open main window")
End
EndIf
If OpenWindowedScreen(WindowID(0), 100, 100, 600, 400, 0, 0, 0) = 0
MessageRequester("Error", "Can't open main windowed screen")
End
EndIf
SetWindowColor(0, RGB(0,0,127))
TextGadget(0, 100, 10, 600, 80, "")
CreateSprite(0, 50, 50)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,50, 50, RGB(255,0,0))
Circle(25, 25, 25, RGB(255,255,255))
StopDrawing()
CreateSprite(1, 50, 50, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(1))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,50, 50, RGBA(255,0,0,255))
Circle(25, 25, 25, RGBA(0,255,0,255))
StopDrawing()
x = 0
move = 10
Repeat
Repeat
Until WindowEvent() = 0
FlipBuffers()
ClearScreen(RGB(0,0,255))
DisplaySprite(0, x, x)
DisplaySprite(1, x+60, x)
SetGadgetText(0, Str(x))
x = x + move
If x < 10
move = 10
EndIf
If x > 340
move = -5
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Space)
Delay(1000)
EndIf
Until KeyboardPushed(#PB_Key_Escape)
End