From: Skullheadx Date: Wed, 4 Sep 2024 20:02:03 +0000 (-0400) Subject: fix sdl2 related issues + screen tear on macos X-Git-Url: http://git.skullheadx.com/nixos/static/git-logo.png?a=commitdiff_plain;h=bab38c01d22da1af2c8d6bfd13c24707f72bc840;p=fruit-ninja.git fix sdl2 related issues + screen tear on macos --- diff --git a/.gitignore b/.gitignore index 3eb56cb..27f9903 100644 --- a/.gitignore +++ b/.gitignore @@ -150,3 +150,4 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ +high_score.txt diff --git a/game.py b/game.py index b07d96c..9f087ee 100644 --- a/game.py +++ b/game.py @@ -17,10 +17,9 @@ class Game: BACKGROUND = pygame.Surface((WIDTH, HEIGHT)) tile_cols = 4 tile_rows = 4 - background_tile = pygame.transform.scale(pygame.image.load("assets/background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() + background_tile = pygame.transform.scale(pygame.image.load("assets/background.png"),((WIDTH+12) / tile_cols, HEIGHT / tile_rows)).convert() dark_background_tile = pygame.transform.scale(pygame.image.load("assets/dark_background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() + ((WIDTH+12) / tile_cols, HEIGHT / tile_rows)).convert() for x in range(tile_cols): for y in range(tile_rows): if y == 0: diff --git a/menu.py b/menu.py index 21ac97b..5d49572 100644 --- a/menu.py +++ b/menu.py @@ -11,7 +11,7 @@ class Menu: tile_cols = 4 tile_rows = 4 background_tile = pygame.transform.scale(pygame.image.load("assets/background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() + ((WIDTH+12) / tile_cols, (HEIGHT+12) / tile_rows)).convert() for x in range(tile_cols): for y in range(tile_rows): background.blit(background_tile, (x * WIDTH / tile_cols, y * HEIGHT / tile_rows)) diff --git a/setup.py b/setup.py index 0c2aced..b869faa 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from functools import cache pygame.init() WIDTH, HEIGHT = pygame.display.Info().current_w, pygame.display.Info().current_h display = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN) -window = Window.from_display_module() +window = Window(size=(WIDTH,HEIGHT), fullscreen=True) renderer = Renderer(window) pygame.mouse.set_visible(False)