added a circle button for the loop stations and the beat player

This commit is contained in:
SallarShayegan
2025-02-28 19:53:20 +01:00
parent 813f8d3a35
commit 134d9aa8e4
2 changed files with 43 additions and 4 deletions

21
circle_button.py Normal file
View 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)