added color shift if dial is being moved
This commit is contained in:
parent
0154888e7a
commit
eb59c63a60
@ -11,6 +11,7 @@ class Dial(pygame.Surface):
|
|||||||
self.rect = self.get_rect()
|
self.rect = self.get_rect()
|
||||||
self.dial_size = dial_size
|
self.dial_size = dial_size
|
||||||
self.center = (self.dial_size / 2, self.dial_size / 2)
|
self.center = (self.dial_size / 2, self.dial_size / 2)
|
||||||
|
self.moving = False
|
||||||
|
|
||||||
self.setting = 1
|
self.setting = 1
|
||||||
|
|
||||||
@ -18,7 +19,10 @@ class Dial(pygame.Surface):
|
|||||||
self.fill((0, 0, 0, 0))
|
self.fill((0, 0, 0, 0))
|
||||||
|
|
||||||
pygame.draw.circle(self, (0, 255, 0), self.center, self.dial_size / 2, 5)
|
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
|
angle = (1.25 - (1.5 * self.setting)) * math.pi
|
||||||
x_1 = (math.cos(angle) * self.dial_size / 2 * 0.75) + (self.dial_size / 2)
|
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:
|
if self.mouse_handler.active:
|
||||||
self.dial.move_dial(self.mouse_handler.get_circular_speed(self.dial.center) / -3000.0)
|
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)
|
self.blit(self.dial, self.dial.rect)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user