Page 1 of 1

PB x.xx WindowedScreen Mouse library

Posted: Sun May 29, 2022 11:05 am
by mk-soft
At first I thought that it is because of my virtualization (Parallels) that the mouse positions (MouseXY, MouseDeltaXY) do not work under Linux.
But on my Raspberry PI 4 (Bullseye) they don't work either.

Code: Select all

InitKeyboard()
InitMouse()
InitSprite()

If OpenWindow(0,50,50,640,480,"Windowed Screen", #PB_Window_WindowCentered | #PB_Window_SystemMenu)
  SetWindowColor(0, #Blue)
  OpenWindowedScreen(WindowID(0),10,10,620,460,0,0,0,#PB_Screen_WaitSynchronization)
  
  CreateSprite(1,16,16)
  StartDrawing(SpriteOutput(1))
  Box(1, 1, 14, 14, #Red)
  StopDrawing()
  
  Repeat
    
    Repeat
      Select WindowEvent()
        Case 0
          Break
        Case #PB_Event_CloseWindow
          Break 2
      EndSelect
    ForEver
    
    ExamineMouse()
    ExamineKeyboard()
    
    ClearScreen(RGB(255,255,255))
    
    DisplaySprite(1,MouseX() - 8,MouseY() - 8)
    
    If MouseButton(#PB_MouseButton_Left)
      If Not fm_left
        fm_left = 1
        Debug "Mouse left"
      EndIf
    ElseIf fm_left
      fm_left = 0
    EndIf
    
    If MouseButton(#PB_MouseButton_Middle)
      If Not fm_middle
        fm_middle = 1
        Debug "Mouse middle"
      EndIf
    ElseIf fm_middle
      fm_middle = 0
    EndIf
    
    If MouseButton(#PB_MouseButton_Right)
      If Not fm_right
        fm_right = 1
        Debug "Mouse right"
      EndIf
    ElseIf fm_right
      fm_right = 0
    EndIf
    
    FlipBuffers()
    
    If KeyboardReleased(#PB_Key_F10)
      If Not rm
        rm = 1
        ReleaseMouse(#True)
      Else
        rm = 0
        ReleaseMouse(#False)
      EndIf
    EndIf
    
  Until KeyboardPushed(#PB_Key_Escape)
EndIf


Re: PB x.xx WindowedScreen Mouse library

Posted: Sun Dec 18, 2022 3:18 pm
by thyphoon
i have the same problem ! have you find a solution ? 😅

Re: PB x.xx WindowedScreen Mouse library

Posted: Sun Dec 18, 2022 3:39 pm
by mk-soft
Yes, I have a solution :wink:

Link: Linux Screen3DMousePatch