Page 1 of 1

[Linux] possible Bug in ExamineMouse()

Posted: Sun Nov 10, 2024 11:06 pm
by Mijikai
Can someone confirm this ?

Linux possible Bug in ExamineMouse()
PureBasic 6.12 LTS (x64)

Example (mouse position is not reported correctly):

Code: Select all

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf
If OpenScreen(800, 600, 32, "Sprite")
  Repeat
    ClearScreen(0)
    StartDrawing(ScreenOutput())
    DrawText(16,16,"Mouse: " + Str(MouseX()) + " x " + Str(MouseY()))
    StopDrawing()
    FlipBuffers()
    ExamineKeyboard()
    ExamineMouse()
  Until KeyboardPushed(#PB_Key_Escape)
Else
  MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf

Now if the position of ExamineKeyboard() and ExamineMouse() are switched it works !?

Code: Select all

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf
If OpenScreen(800, 600, 32, "Sprite")
  Repeat
    ClearScreen(0)
    StartDrawing(ScreenOutput())
    DrawText(16,16,"Mouse: " + Str(MouseX()) + " x " + Str(MouseY()))
    StopDrawing()
    FlipBuffers()
    ExamineMouse()
    ExamineKeyboard()
  Until KeyboardPushed(#PB_Key_Escape)
Else
  MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf
What is going on :?:

Re: [Linux] possible Bug in ExamineMouse()

Posted: Tue Nov 12, 2024 11:09 am
by Olli
I think the devices init and the commands main loop follows an order.

Code: Select all

Delay(pauseDuration)
ExamineKeyboard()
ExamineMouse()
; Records here the devices datas
; Displays here the sprites (with or without any levels)
FlipBuffers()