Commit a15ff8fb authored by santiago duque's avatar santiago duque

added second button and logic to stop events as a test

parent 3b289386
......@@ -17,11 +17,8 @@ window = pygame.display.set_mode((winW, winH))
# window.fill((205,100,100))
# pygame.display.update()
# clock = pygame.time.Clock()
clock = pygame.time.Clock()
btn1 = Button(21)
btn1.when_pressed = lambda : play_sound(0)
def reset_sounds():
global sound_array
......@@ -56,6 +53,9 @@ def play_sound(index):
global current_sound_index
global channel
global sound_array
global btn_array
btn_array[index].when_pressed = None
if not cut_current_sound:
current_sound_index = index
......@@ -117,9 +117,21 @@ current_sound_index = -1
# run setup
setup_paths(False)
btn1 = Button(21)
btn1.when_pressed = lambda: play_sound(0)
btn1.when_released = lambda: btn1.when_pressed = lambda: play_sound(0)
btn2 = Button(13)
btn2.when_pressed = lambda: play_sound(1)
btn2.when_released = lambda: btn2.when_pressed = lambda: play_sound(1)
btn_array = [btn1, btn2]
run = True
while run:
# clock.tick(30)
clock.tick(25)
for event in pygame.event.get():
if event.type == pygame.QUIT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment