hid mouse

This commit is contained in:
Nicholas Dyer 2023-02-20 00:18:12 -05:00
parent 238c74b0ec
commit fba570e432
No known key found for this signature in database
GPG Key ID: E4E6388793FA2105

View File

@ -21,8 +21,8 @@ class Dial(pygame.Surface):
pygame.draw.circle(self, (64, 64, 64), self.center, self.dial_size / 2 * 0.95)
angle = (1.25 - (1.5 * self.setting)) * math.pi
x_1 = (math.cos(angle) * self.dial_size / 2 * 0.8) + (self.dial_size / 2)
y_1 = (-1 * math.sin(angle) * self.dial_size / 2 * 0.8) + (self.dial_size / 2)
x_1 = (math.cos(angle) * self.dial_size / 2 * 0.75) + (self.dial_size / 2)
y_1 = (-1 * math.sin(angle) * self.dial_size / 2 * 0.75) + (self.dial_size / 2)
x_2 = (math.cos(angle) * self.dial_size / 2 * 0.99) + (self.dial_size / 2)
y_2 = (-1 * math.sin(angle) * self.dial_size / 2 * 0.99) + (self.dial_size / 2)
pygame.draw.line(self, (0, 255, 0), (x_1, y_1), (x_2, y_2), 10)
@ -50,8 +50,7 @@ class MouseHandler:
mouse_angle = math.atan2(self.mouse_pos[0] - center[0], self.mouse_pos[1] - center[1])
diff_angle = math.atan2(mouse_diff[0], mouse_diff[1])
speed_coeff = math.cos((mouse_angle - (0.5 * math.pi)) - diff_angle)
final_speed = movement_speed * speed_coeff
return final_speed
return movement_speed * speed_coeff
class Surface(pygame.Surface):
def __init__(self, window_size):
@ -66,6 +65,8 @@ class Surface(pygame.Surface):
self.mouse_handler = MouseHandler()
pygame.mouse.set_visible(False)
def update(self):
self.fill((32, 32, 32))