-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.py
75 lines (50 loc) · 1.85 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from grabber import *
import time
from os import system
import math
from win32api import GetSystemMetrics
import os
import cv2
import threading
# fov, over 290 will break shit,
fov = 160
# lower to get more fps but worse performance
fps = 72
# list of virtual keys: https://learn.microsoft.com/windows/win32/inputdev/virtual-key-codes
# default = mouse1
aim_key = 0x01
# default = v
trigger_key = 0x12
hitbox_size = 0.6
grabber = Grabber(
# x and y accel. higher = faster
x_multiplier = 0.60,
y_multiplier = 0.14,
# idk this shit is supposed to set the height of where u aim but I think its broken
y_difference = 6,
)
#################################################################################################
left, top = (GetSystemMetrics(0) - fov) // 2, (GetSystemMetrics(1) - fov) // 2
right, bottom = left + fov, top + fov
region = (left, top, right, bottom)
camera = dxcam.create(region=region, output_color="BGR")
camera.start(target_fps=fps)
grabber.find_dimensions(fov)
random_title = grabber.build_title(20)
system('title ' + f"'{random_title}'")
system('cls')
print(f'box_size = {grabber.box_size}')
print(f'random_title = {random_title}')
print(f"x accel = {grabber.x_multiplier}")
print(f"y accel = {grabber.y_multiplier}")
#################################################################################################
while True:
og = np.array(camera.get_latest_frame())
frame = grabber.process_frame(og)
contours = grabber.detect_contours(frame, 100)
if grabber.is_activated(aim_key) and contours:
rec, x, y = grabber.compute_centroid(contours)
grabber.move_mouse(x, y)
if grabber.is_activated(trigger_key) and contours:
if grabber.on_target(contours, hitbox_size):
grabber.trigger()