added --windowed parameter, fixed missing surface assignment
This commit is contained in:
parent
d932538b41
commit
e6cb2bd4c8
@ -9,15 +9,18 @@ import pocket_friends.game_files.game as game
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_dev = False
|
||||
windowed = False
|
||||
|
||||
# enable dev mode if --dev argument is passed
|
||||
if len(sys.argv) > 0:
|
||||
for args in sys.argv:
|
||||
if args == '--delete-save':
|
||||
for arg in sys.argv:
|
||||
if arg == '--delete-save':
|
||||
save_dir = os.path.join(Path.home(), '.pocket_friends')
|
||||
os.remove(save_dir + '/save.json')
|
||||
if arg == '--windowed':
|
||||
windowed = True
|
||||
|
||||
game.main()
|
||||
game.main(windowed)
|
||||
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
@ -32,7 +32,7 @@ starting_surface = 'title'
|
||||
# Gets the directory of the script for importing and the save directory
|
||||
|
||||
|
||||
def game():
|
||||
def game(windowed=False):
|
||||
"""
|
||||
Starts the game.
|
||||
"""
|
||||
@ -41,9 +41,14 @@ def game():
|
||||
# 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 = 240
|
||||
pygame.mouse.set_visible(False)
|
||||
window = pygame.display.set_mode((screen_size, screen_size), pygame.FULLSCREEN)
|
||||
if windowed:
|
||||
screen_size = 480
|
||||
window = pygame.display.set_mode((screen_size, screen_size))
|
||||
else:
|
||||
screen_size = 240
|
||||
pygame.mouse.set_visible(False)
|
||||
window = pygame.display.set_mode((screen_size, screen_size), pygame.FULLSCREEN)
|
||||
surface = surface_modules.get(starting_surface).Surface((game_res, game_res), resources_dir, game_fps)
|
||||
|
||||
# Add an icon to the pygame window.
|
||||
icon = pygame.image.load(resources_dir + '/icon/icon.png').convert_alpha()
|
||||
@ -75,10 +80,10 @@ def game():
|
||||
pygame.display.flip()
|
||||
|
||||
|
||||
def main():
|
||||
def main(windowed=False):
|
||||
"""
|
||||
Calls the game() function to start the game.
|
||||
"""
|
||||
game()
|
||||
game(windowed)
|
||||
|
||||
pygame.quit()
|
||||
|
Loading…
Reference in New Issue
Block a user