2021-06-20 20:52:23 -04:00
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
import argparse
|
|
|
|
import pygame
|
|
|
|
import sys
|
|
|
|
from pocket_friends.game_files.game import main as game_main
|
2021-07-02 01:48:36 -04:00
|
|
|
from pocket_friends.development.dev_menu import main as dev_main
|
2021-06-20 20:52:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
"""
|
|
|
|
Launch script for Pocket Friends.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Creates the parser object.
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
|
# Adds parser arguments.
|
|
|
|
parser.add_argument('-D', '--delete-save', action='store_true', help='Deletes the save file if it exists.')
|
2021-07-02 01:48:36 -04:00
|
|
|
parser.add_argument('-s', '--size', type=int, default=240, help='Sets the size of the window.')
|
|
|
|
parser.add_argument('--dev', action='store_true', help='Deletes the save file if it exists.')
|
2021-06-20 20:52:23 -04:00
|
|
|
|
|
|
|
# Parse the arguments given
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
# If given the delete-save argument, delete the safe file
|
|
|
|
if args.delete_save:
|
|
|
|
save_dir = os.path.join(Path.home(), '.pocket_friends')
|
|
|
|
# Remove the file if it exists
|
|
|
|
try:
|
|
|
|
os.remove(save_dir + '/save.json')
|
|
|
|
print('Save file deleted.')
|
|
|
|
except FileNotFoundError:
|
|
|
|
print('Save file does not exist, cannot delete.')
|
|
|
|
|
|
|
|
# Set the screen size
|
|
|
|
screen_size = int(args.size)
|
|
|
|
|
2021-07-02 01:48:36 -04:00
|
|
|
if not args.dev:
|
|
|
|
game_main(screen_size)
|
|
|
|
else:
|
|
|
|
dev_main()
|
2021-06-20 20:52:23 -04:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
pygame.quit()
|
|
|
|
sys.exit()
|