Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from System import Int16
- from ctypes import windll, Structure, c_ulong, byref
- class POINT(Structure):
- _fields_ = [("x", c_ulong), ("y", c_ulong)]
- if starting:
- Joy_stat = False
- vJoy_Key = Key.CapsLock
- vJoy[0].x = 0
- mouse_x = 0
- mouse_y = 0
- screen_x = windll.user32.GetSystemMetrics(0)
- screen_y = windll.user32.GetSystemMetrics(1)
- pt = POINT()
- preci = 100
- multipler_x = preci * 32768 / screen_x
- multipler_y = preci * 32768 / screen_y
- Freeview = mouse.middleButton
- #Freeview = keyboard.getKeyDown(Key.V)
- # Включение и отключение калибровочной оси Z
- if keyboard.getPressed(vJoy_Key):
- if Joy_stat: # при отключении джойстик встает в 0
- Joy_stat = False
- vJoy[0].x = 0
- vJoy[0].y = 0
- vJoy[0].z = 0
- vJoy[0].rz = 0
- windll.user32.SetCursorPos(screen_x / 2, screen_y / 2)
- else:
- Joy_stat = True
- # Опрос мыши
- windll.user32.GetCursorPos(byref(pt))
- if pt.x > 65536: mouse_x = 0
- else: mouse_x = pt.x
- if pt.y > 65536: mouse_y = 0
- else: mouse_y = pt.y
- if Joy_stat:
- vJoy[0].rz = (mouse_y - (screen_y / 2)) * multipler_y / preci
- vJoy[0].z = (mouse_x - (screen_x / 2)) * multipler_x / preci
- else:
- vJoy[0].y = (mouse_y - (screen_y / 2)) * multipler_y / preci
- vJoy[0].x = (mouse_x - (screen_x / 2)) * multipler_x / preci
- diagnostics.watch(Joy_stat)
- diagnostics.watch(vJoy[0].x)
- diagnostics.watch(vJoy[0].y)
- diagnostics.watch(vJoy[0].z)
- diagnostics.watch(vJoy[0].rz)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement