added a circle button for the loop stations and the beat player
This commit is contained in:
21
circle_button.py
Normal file
21
circle_button.py
Normal file
@ -0,0 +1,21 @@
|
||||
import pygame
|
||||
from colors import *
|
||||
import math
|
||||
|
||||
class CircleButton:
|
||||
|
||||
def __init__(self, gui, x, y, radius):
|
||||
self.screen = gui.screen
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.radius = radius
|
||||
self.color = color_primary
|
||||
|
||||
def check_click(self, pos, action):
|
||||
if math.sqrt(math.pow(pos[0] - self.x, 2) +
|
||||
math.pow(pos[1] - self.y, 2)) < self.radius:
|
||||
action()
|
||||
|
||||
def display(self):
|
||||
pygame.draw.circle(self.screen, self.color,
|
||||
(self.x, self.y), self.radius)
|
||||
Reference in New Issue
Block a user