diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-11-12 13:32:37 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-11-12 13:32:37 +0100 |
commit | adf005bd29a395b653df1d990aa72694360a11dc (patch) | |
tree | d3cf034b95fc38c0e2d0217581d5e5f7f3689b43 /cameltris.py | |
parent | 5bbc2d3008910bb9c1f9eb07d7dde5bda8aa52f4 (diff) |
Rename the package cameltris and provide __main__.py
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'cameltris.py')
-rwxr-xr-x | cameltris.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/cameltris.py b/cameltris.py deleted file mode 100755 index 50ebb01..0000000 --- a/cameltris.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -import argparse - -import pygame - -from pycameltris.controller import Controller, KeyboardController, JoystickController -from pycameltris.screens.Screen import Screen -from pycameltris.screens.InGame import InGame as InGameScreen, Player -from pycameltris.screens.Pause import Pause as PauseScreen -from pycameltris.misc import Pause, UnPause - - -PARSER = argparse.ArgumentParser() - -PARSER.add_argument("--starting-level", type=int, choices=list(range(1, 30)), default=1) -PARSER.add_argument("--joystick", type=int, dest="joystick_id", metavar="Joystick ID") - -ARGS = vars(PARSER.parse_args()) - -print(ARGS) - -pygame.init() - -screen = pygame.display.set_mode((801, 1000)) - -controller: Controller -if ARGS["joystick_id"] is not None: - joystick = pygame.joystick.Joystick(ARGS["joystick_id"]) - joystick.init() - controller = JoystickController(joystick) -else: - controller = KeyboardController(pygame.key) - -# Just one player -players = [Player(controller, ARGS["starting_level"])] - -for player in players: - player.refresh_piece_preview_canvas() - -clock = pygame.time.Clock() - -current_screen: Screen -current_screen = ingame_screen = InGameScreen(players, screen) - -while True: - try: - current_screen.oneframe() - except Pause: - current_screen = PauseScreen(screen) - except UnPause: - current_screen = ingame_screen - - current_screen.refresh() - pygame.display.update() - - clock.tick(60) |