threers

FreePIE mouse lock example

Aug 1st, 2018
2,797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. from ctypes import *
  2. user32 = windll.user32
  3.  
  4. if starting:
  5.     mouselock = False # for assetto corsa
  6.  
  7. toggle_mouselock = keyboard.getPressed(Key.M) # assign toggle key. if want to assign on mouse, use "mouse.getPressed(2)" instead, 2=middle button, 0=left and 1=right
  8.  
  9. if toggle_mouselock:
  10.     mouselock = not mouselock
  11. if (mouselock):
  12.     user32.SetCursorPos(0, 5000) # lock mouse at left-bottom of screen (x y pixel coordinates)
  13.  
  14. # note: line number 1,2,12 are core codes. however setup a toggle is required to free and lock mouse.
Add Comment
Please, Sign In to add comment