diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/__init__.py b/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/binary_button.py b/binary_button.py old mode 100644 new mode 100755 index e2033fc..e591d7c --- a/binary_button.py +++ b/binary_button.py @@ -1,6 +1,6 @@ import pygame -from fonts import * -from colors import * +from .fonts import * +from .colors import * class BinaryButton: diff --git a/circle_button.py b/circle_button.py old mode 100644 new mode 100755 index a5b31e6..db8bb7e --- a/circle_button.py +++ b/circle_button.py @@ -1,5 +1,5 @@ import pygame -from colors import * +from .colors import * import math class CircleButton: diff --git a/colors.py b/colors.py old mode 100644 new mode 100755 diff --git a/fonts.py b/fonts.py old mode 100644 new mode 100755 diff --git a/knob.py b/knob.py old mode 100644 new mode 100755 index 41810a1..1506873 --- a/knob.py +++ b/knob.py @@ -1,6 +1,6 @@ import pygame import math -from colors import * +from .colors import * class Knob: diff --git a/knobs.py b/knobs.py old mode 100644 new mode 100755 index f707c06..2bc9f91 --- a/knobs.py +++ b/knobs.py @@ -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: diff --git a/lozenge_button.py b/lozenge_button.py old mode 100644 new mode 100755 index 75f23f5..d1f820e --- a/lozenge_button.py +++ b/lozenge_button.py @@ -1,7 +1,7 @@ import pygame import math -from colors import * -from fonts import * +from .colors import * +from .fonts import * class LozengeButton: diff --git a/main.py b/main.py old mode 100644 new mode 100755 index edcf00e..725ef70 --- a/main.py +++ b/main.py @@ -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() \ No newline at end of file + else: + pygame.quit()