Merge pull request 'background' (#13) from background into master
Reviewed-on: #13
This commit is contained in:
commit
5976f41f12
@ -1,4 +1,5 @@
|
||||
import pygame
|
||||
from PIL import Image
|
||||
|
||||
class GameContext:
|
||||
dust_car_speed = 20
|
||||
@ -9,4 +10,10 @@ class GameContext:
|
||||
canvas = None
|
||||
|
||||
def startup(game_context: GameContext):
|
||||
render_background(game_context)
|
||||
game_context.canvas.blit(game_context.dust_car_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y))
|
||||
|
||||
def render_background(game_context: GameContext):
|
||||
bg_img = Image.open("imgs/background.jpg")
|
||||
pygame_bg_image = pygame.image.frombuffer(bg_img.tobytes(), bg_img.size, 'RGB')
|
||||
game_context.canvas.blit(pygame_bg_image, (0, 0))
|
||||
|
BIN
imgs/background.jpg
Normal file
BIN
imgs/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 238 KiB |
Loading…
Reference in New Issue
Block a user