Merge branch 'bg' into 'master'

backgrounde eingefügt

See merge request !1
This commit is contained in:
Patrick Tschuchnig 2019-10-29 10:11:37 +01:00
commit d440d24309
2 changed files with 11 additions and 1 deletions

View File

@ -438,8 +438,9 @@ def change_led_colour(red_amount, green_amount, blue_amount):
return True return True
def clear_screen(): def clear_screen():
"""fills the screen with a colour""" """fills the screen with a colour and draws the background"""
screen.fill(pygame_color_white) screen.fill(pygame_color_white)
draw_background()
def handle_events(): def handle_events():
"""looks for things to do every tick""" """looks for things to do every tick"""
@ -579,6 +580,10 @@ def check_highscores(time):
else: else:
return False return False
def draw_background():
"""draw background image"""
screen.blit(img_background_image, (0,0))
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) pygame.draw.rect(screen, pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5)
@ -635,6 +640,11 @@ img_metalliclogo_image = pygame.image.load(img_metalliclogo)
img_metalliclogo_imagex = get_image_width(img_metalliclogo) img_metalliclogo_imagex = get_image_width(img_metalliclogo)
img_metalliclogo_imagey = get_image_height(img_metalliclogo) img_metalliclogo_imagey = get_image_height(img_metalliclogo)
img_background = 'img/bg.png'
img_background_image = pygame.image.load(img_background)
img_background_imagex = get_image_width(img_background)
img_background_imagey = get_image_height(img_background)
# initialise led strip # initialise led strip
led_init() led_init()

BIN
img/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB