added color shift if dial is being moved

This commit is contained in:
Nicholas Dyer 2023-02-20 00:37:58 -05:00
parent 0154888e7a
commit eb59c63a60
No known key found for this signature in database
GPG Key ID: E4E6388793FA2105

View File

@ -11,6 +11,7 @@ class Dial(pygame.Surface):
self.rect = self.get_rect()
self.dial_size = dial_size
self.center = (self.dial_size / 2, self.dial_size / 2)
self.moving = False
self.setting = 1
@ -18,7 +19,10 @@ class Dial(pygame.Surface):
self.fill((0, 0, 0, 0))
pygame.draw.circle(self, (0, 255, 0), self.center, self.dial_size / 2, 5)
pygame.draw.circle(self, (64, 64, 64), self.center, self.dial_size / 2 * 0.95)
if self.moving:
pygame.draw.circle(self, (48, 48, 48), self.center, self.dial_size / 2 * 0.95)
else:
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.75) + (self.dial_size / 2)
@ -89,6 +93,9 @@ class Surface(pygame.Surface):
if self.mouse_handler.active:
self.dial.move_dial(self.mouse_handler.get_circular_speed(self.dial.center) / -3000.0)
self.dial.moving = True
else:
self.dial.moving = False
self.blit(self.dial, self.dial.rect)