Skip to content

Commit

Permalink
fix help cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
AkiaCode committed Aug 19, 2023
1 parent 4427cd8 commit 662f718
Showing 1 changed file with 36 additions and 44 deletions.
80 changes: 36 additions & 44 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,45 @@ def main():


if __name__ == "__main__":
help = False

try:
import argparse
import sys

parser = argparse.ArgumentParser(description="The Chromatic: A hero's long journey", add_help=False)
parser.add_argument('-h', '--help', help='도움 메시지가 출력됩니다.', action="store_true")
parser.add_argument("-d", "--debug", help="디버깅 메시지가 출력됩니다.", action="store_true")
parser.add_argument("-f", "--fps", help="FPS를 표시합니다.", action="store_true")
parser.add_argument("-fs", "--fullscreen", help="전체화면으로 시작됩니다.", action="store_true")
parser.add_argument("-fhd", "--fullhd", help="FHD (1920x1080) 해상도로 시작됩니다.", action="store_true")
parser.add_argument("-qhd", "--quadhd", help="QHD (2560x1440) 해상도로 시작됩니다.", action="store_true")
args = parser.parse_args()

if args.debug:
CONFIG.is_debug = True
from icecream import ic
from datetime import datetime

ic.configureOutput(prefix=f"{datetime.now()}|>") # 디버깅용 debug("테스트하면 됨")

if args.fps:
CONFIG.game_fps = True

if args.fullscreen:
CONFIG.is_fullscreen = True

if args.fullhd:
CONFIG.window_size = (1920, 1080)
CONFIG.window_scale = 3

update_screen_resolution()

elif args.quadhd:
CONFIG.window_size = (2560, 1440)
CONFIG.window_scale = 4
import argparse
import sys

parser = argparse.ArgumentParser(description="The Chromatic: A hero's long journey", add_help=False)
parser.add_argument('-h', '--help', help='도움 메시지가 출력됩니다.', action="store_true")
parser.add_argument("-d", "--debug", help="디버깅 메시지가 출력됩니다.", action="store_true")
parser.add_argument("-f", "--fps", help="FPS를 표시합니다.", action="store_true")
parser.add_argument("-fs", "--fullscreen", help="전체화면으로 시작됩니다.", action="store_true")
parser.add_argument("-fhd", "--fullhd", help="FHD (1920x1080) 해상도로 시작됩니다.", action="store_true")
parser.add_argument("-qhd", "--quadhd", help="QHD (2560x1440) 해상도로 시작됩니다.", action="store_true")
args = parser.parse_args()

if args.debug:
CONFIG.is_debug = True
from icecream import ic
from datetime import datetime

ic.configureOutput(prefix=f"{datetime.now()}|>") # 디버깅용 debug("테스트하면 됨")

update_screen_resolution()
if args.fps:
CONFIG.game_fps = True

if hasattr(args, 'help') and args.help:
help = True
parser.print_help(sys.stderr)
if args.fullscreen:
CONFIG.is_fullscreen = True

if args.fullhd:
CONFIG.window_size = (1920, 1080)
CONFIG.window_scale = 3

update_screen_resolution()

elif args.quadhd:
CONFIG.window_size = (2560, 1440)
CONFIG.window_scale = 4

except SystemExit:
pass
update_screen_resolution()

if not help:
if hasattr(args, 'help') and args.help:
parser.print_help(sys.stderr)
else:
main()
pygame.quit()

0 comments on commit 662f718

Please sign in to comment.