adapted the modules for integrating into the santoscope repository
This commit is contained in:
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
__init__.py
Executable file
0
__init__.py
Executable file
4
binary_button.py
Normal file → Executable file
4
binary_button.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
import pygame
|
||||
from fonts import *
|
||||
from colors import *
|
||||
from .fonts import *
|
||||
from .colors import *
|
||||
|
||||
class BinaryButton:
|
||||
|
||||
|
||||
2
circle_button.py
Normal file → Executable file
2
circle_button.py
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
import pygame
|
||||
from colors import *
|
||||
from .colors import *
|
||||
import math
|
||||
|
||||
class CircleButton:
|
||||
|
||||
2
knob.py
Normal file → Executable file
2
knob.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
import pygame
|
||||
import math
|
||||
from colors import *
|
||||
from .colors import *
|
||||
|
||||
class Knob:
|
||||
|
||||
|
||||
6
knobs.py
Normal file → Executable file
6
knobs.py
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
import pygame
|
||||
from colors import *
|
||||
from fonts import *
|
||||
from knob import *
|
||||
from .colors import *
|
||||
from .fonts import *
|
||||
from .knob import *
|
||||
import random
|
||||
|
||||
class Knobs:
|
||||
|
||||
4
lozenge_button.py
Normal file → Executable file
4
lozenge_button.py
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
import pygame
|
||||
import math
|
||||
from colors import *
|
||||
from fonts import *
|
||||
from .colors import *
|
||||
from .fonts import *
|
||||
|
||||
class LozengeButton:
|
||||
|
||||
|
||||
42
main.py
Normal file → Executable file
42
main.py
Normal file → Executable 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()
|
||||
|
||||
Reference in New Issue
Block a user