adapted the modules for integrating into the santoscope repository

This commit is contained in:
SallarShayegan
2025-03-13 19:42:58 +01:00
parent 692da4b3f2
commit 24a60d7745
10 changed files with 25 additions and 35 deletions

42
main.py Normal file → Executable file
View File

@ -1,10 +1,10 @@
import pygame
from colors import *
from fonts import *
from knobs import Knobs
from lozenge_button import LozengeButton
from binary_button import BinaryButton
from circle_button import *
from .colors import *
from .fonts import *
from .knobs import Knobs
from .lozenge_button import LozengeButton
from .binary_button import BinaryButton
from .circle_button import *
class GuiMain:
@ -67,7 +67,6 @@ class GuiMain:
self.clock = pygame.time.Clock()
self.running = True
self.run()
def set_fx_mode(self, mode):
self.knobs[self.fx_mode].opacity = 0
@ -77,19 +76,11 @@ class GuiMain:
for b in self.fx_mode_buttons:
b.focused = (b.name == mode)
def run(self):
while self.running:
# poll for events
# pygame.QUIT event means the user clicked X to close your window
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.running = False
def update(self):
if self.running:
# fill the screen with a color to wipe away anything from last frame
self.screen.fill("black")
# RENDER YOUR GAME HERE
self.screen.blit(self.label_surface, (0,0))
self.label_surface = pygame.Surface((self.screenW, self.screenH), pygame.SRCALPHA)
@ -114,22 +105,21 @@ class GuiMain:
# flip() the display to put your work on screen
pygame.display.flip()
self.clock.tick(60) # limits FPS to 60
self.clock.tick(30) # limits FPS to 60
# exit when esc is pressed
for event in pygame.event.get():
# exit when esc is pressed
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pygame.quit()
return
if event.type == pygame.MOUSEBUTTONDOWN:
self.running = False
elif event.type == pygame.QUIT:
self.running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
self.mute_button.check_click(pygame.mouse.get_pos())
self.rec_button.check_click(pygame.mouse.get_pos())
self.beat_button.check_click(pygame.mouse.get_pos())
self.lloop_button.check_click(pygame.mouse.get_pos())
self.rloop_button.check_click(pygame.mouse.get_pos())
pygame.quit()
GuiMain()
else:
pygame.quit()