[Linux] possible Bug in ExamineMouse()

Just starting out? Need help? Post your questions and find answers here.
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

[Linux] possible Bug in ExamineMouse()

Post 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 :?:
Olli
Addict
Addict
Posts: 1266
Joined: Wed May 27, 2020 12:26 pm

Re: [Linux] possible Bug in ExamineMouse()

Post 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()
Post Reply