Sound geändert und draw borders

This commit is contained in:
Raphael 2019-10-29 15:54:18 +01:00
parent c3e1af432a
commit fd577157ba
3 changed files with 15 additions and 10 deletions

View File

@ -238,6 +238,9 @@ import RPi.GPIO as GPIO
pygame_fps = 30 #frames per second setting pygame_fps = 30 #frames per second setting
pygame_clock = pygame.time.Clock() pygame_clock = pygame.time.Clock()
# enable border drawing
cfg_borders_enabled = False
# GPIO for Buttons # GPIO for Buttons
pin_start = 32 pin_start = 32
pin_stop = 37 pin_stop = 37
@ -284,7 +287,8 @@ screen_size_x = pygame.display.Info().current_w
screen_size_y = pygame.display.Info().current_h screen_size_y = pygame.display.Info().current_h
# load sound effects # load sound effects
error_sound = pygame.mixer.Sound('snd/buzz.wav') #error_sound = pygame.mixer.Sound('snd/buzz.wav')
error_sound = pygame.mixer.Sound('snd/nope.wav')
logoff_sound = pygame.mixer.Sound('snd/winxplogoff.wav') logoff_sound = pygame.mixer.Sound('snd/winxplogoff.wav')
# fonts # fonts
@ -381,7 +385,7 @@ def change_red(amount):
global led_red global led_red
factor = 100/255 factor = 100/255
led_green.ChangeDutyCycle(amount*factor) led_red.ChangeDutyCycle(amount*factor)
def change_green(amount): def change_green(amount):
""" """
@ -496,7 +500,7 @@ def enter_name():
screen.blit(textbox_surface, textbox_rectangle) screen.blit(textbox_surface, textbox_rectangle)
# add the border and logos # add the border and logos
#draw_border() draw_border()
draw_logos() draw_logos()
# display everything # display everything
@ -586,7 +590,8 @@ def draw_background():
def draw_border(): def draw_border():
"""draw rectangle border around everything""" """draw rectangle border around everything"""
pygame.draw.rect(screen, pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5) if cfg_borders_enabled:
pygame.draw.rect(screen, pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5)
def draw_logos(): def draw_logos():
"""draw logos""" """draw logos"""
@ -852,7 +857,7 @@ while True:
pass pass
# overlaying structure - this is to be drawn no matter what's below # overlaying structure - this is to be drawn no matter what's below
#draw_border() draw_border()
draw_logos() draw_logos()
# flip everything, update display, do a tick # flip everything, update display, do a tick

View File

@ -110,9 +110,9 @@ led_init()
while True: while True:
#change_led_colour(100,0,0) change_led_colour(100,0,0)
#time.sleep(10) time.sleep(2)
#change_led_colour(0,100,0) change_led_colour(0,100,0)
#time.sleep(10) time.sleep(2)
change_led_colour(0,0,100) change_led_colour(0,0,100)
time.sleep(10) time.sleep(2)

BIN
snd/nope.wav Normal file

Binary file not shown.