added a binary_button module for the mute function
This commit is contained in:
21
main.py
21
main.py
@ -3,12 +3,14 @@ from colors import *
|
||||
from fonts import *
|
||||
from knobs import Knobs
|
||||
from lozenge_button import LozengeButton
|
||||
from binary_button import BinaryButton
|
||||
|
||||
class GuiMain:
|
||||
|
||||
def __init__(self):
|
||||
# pygame setup
|
||||
pygame.init()
|
||||
pygame.display.set_caption("SantoscopeUI")
|
||||
self.screen = pygame.display.set_mode((800, 480))
|
||||
#self.screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
|
||||
self.screenH = self.screen.get_height()
|
||||
@ -40,7 +42,9 @@ class GuiMain:
|
||||
self.knobs.append(Knobs(self))
|
||||
|
||||
self.set_fx_mode(self.fx_mode_labels[self.fx_mode])
|
||||
|
||||
|
||||
self.mute_button = BinaryButton(self.screen, (20, self.fx_mode_buttons[0].y-20), (40, 40), 'M', False)
|
||||
|
||||
self.clock = pygame.time.Clock()
|
||||
self.running = True
|
||||
self.run()
|
||||
@ -69,6 +73,8 @@ class GuiMain:
|
||||
for button in self.fx_mode_buttons:
|
||||
button.display()
|
||||
|
||||
self.mute_button.display()
|
||||
|
||||
for i in range(1,4):
|
||||
pygame.draw.line(self.screen, color_primary_dark,
|
||||
(self.fx_mode_buttons[i].radius_x*0.5 + 60, self.fx_mode_buttons[i].y),
|
||||
@ -76,8 +82,6 @@ class GuiMain:
|
||||
self.fx_mode_buttons[i].y))
|
||||
pygame.draw.circle(self.screen, color_primary,
|
||||
(40, self.fx_mode_buttons[i].y), 20)
|
||||
pygame.draw.rect(self.screen, color_primary,
|
||||
((20, self.fx_mode_buttons[0].y-20),(40, 40)))
|
||||
|
||||
pygame.draw.polygon(self.screen, "white", [(0, self.screenH/2), (self.screenW*3 / 19, self.screenH), (0, self.screenH)])
|
||||
# flip() the display to put your work on screen
|
||||
@ -87,10 +91,13 @@ class GuiMain:
|
||||
|
||||
# exit when esc is pressed
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
pygame.quit()
|
||||
return
|
||||
if event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
pygame.quit()
|
||||
return
|
||||
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||
if event.button == 1:
|
||||
self.mute_button.check_click(pygame.mouse.get_pos())
|
||||
|
||||
pygame.quit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user