Notepad++ generated in local folder (no need)
parent
e36bad491f
commit
043097a122
|
|
@ -1,39 +0,0 @@
|
||||||
import base
|
|
||||||
from pynput import mouse
|
|
||||||
|
|
||||||
class MouseEvents():
|
|
||||||
def __init__(self):
|
|
||||||
listener = mouse.Listener(
|
|
||||||
on_move=on_move,
|
|
||||||
on_click=on_click,
|
|
||||||
on_scroll=on_scroll)
|
|
||||||
listener.start()
|
|
||||||
|
|
||||||
# MOUSE EVENTS/LISTENER
|
|
||||||
def on_move(x, y):
|
|
||||||
if base.data["move"]:
|
|
||||||
if base.data["mouse_distance_x"] == 0:
|
|
||||||
base.data["mouse_distance_x"] = base.sights.get(base.data["active_sight"]).pos().x()-x
|
|
||||||
if base.data["mouse_distance_y"] == 0:
|
|
||||||
base.data["mouse_distance_y"] = base.sights.get(base.data["active_sight"]).pos().y()-y
|
|
||||||
try:
|
|
||||||
x_point = x+base.data["mouse_distance_x"]
|
|
||||||
y_point = y+base.data["mouse_distance_y"]
|
|
||||||
#print( str(x_point) + " x " + str(y_point))
|
|
||||||
base.sights.get(base.data["active_sight"]).move(x_point, y_point)
|
|
||||||
except:
|
|
||||||
print("e")
|
|
||||||
|
|
||||||
def on_click(x, y, button, pressed):
|
|
||||||
if pressed:
|
|
||||||
print("pressed on " +base.data["active_sight"])
|
|
||||||
else:
|
|
||||||
print("released")
|
|
||||||
base.data["mouse_distance_x"] = 0
|
|
||||||
base.data["mouse_distance_y"] = 0
|
|
||||||
base.data["move"] = False
|
|
||||||
|
|
||||||
def on_scroll(x, y, dx, dy):
|
|
||||||
print('Scrolled {0} at {1}'.format(
|
|
||||||
'down' if dy < 0 else 'up',
|
|
||||||
(x, y)))
|
|
||||||
Loading…
Reference in New Issue