changed resolution to 240x240 fullscreen by default

This commit is contained in:
Nicholas Dyer 2023-05-12 23:36:21 -04:00
parent 526b51b754
commit d932538b41
2 changed files with 7 additions and 19 deletions

View File

@ -40,15 +40,10 @@ def game():
# The game is normally rendered at 80 pixels and upscaled from there. If changing displays, change the # The game is normally rendered at 80 pixels and upscaled from there. If changing displays, change the
# screen_size to reflect what the resolution of the new display is. # screen_size to reflect what the resolution of the new display is.
if gpio_handler.ON_HARDWARE:
gpio_handler.setup()
screen_size = 240 screen_size = 240
pygame.mouse.set_visible(False) pygame.mouse.set_visible(False)
window = pygame.display.set_mode((screen_size, screen_size), pygame.FULLSCREEN) window = pygame.display.set_mode((screen_size, screen_size), pygame.FULLSCREEN)
else:
screen_size = 240*2
window = pygame.display.set_mode((screen_size, screen_size))
surface = surface_modules.get(starting_surface).Surface((game_res, game_res), resources_dir, game_fps)
# Add an icon to the pygame window. # Add an icon to the pygame window.
icon = pygame.image.load(resources_dir + '/icon/icon.png').convert_alpha() icon = pygame.image.load(resources_dir + '/icon/icon.png').convert_alpha()
@ -86,5 +81,4 @@ def main():
""" """
game() game()
gpio_handler.teardown()
pygame.quit() pygame.quit()

View File

@ -5,13 +5,7 @@ import importlib.util
# If the RPi.GPIO module is not found (aka the program is not running on a Pi), import the fake # If the RPi.GPIO module is not found (aka the program is not running on a Pi), import the fake
# GPIO module instead to prevent a crash. # GPIO module instead to prevent a crash.
ON_HARDWARE = None # Flag to tell other methods if the program is running on hardware or not #ON_HARDWARE = None # Flag to tell other methods if the program is running on hardware or not
try:
importlib.util.find_spec('RPi.GPIO')
import RPi.GPIO as GPIO
ON_HARDWARE = False
except ImportError:
import pocket_friends.game_files.io.fake_gpio as GPIO import pocket_friends.game_files.io.fake_gpio as GPIO
ON_HARDWARE = False ON_HARDWARE = False