#!/usr/bin/env python
# This file is part of ROBOTGAME
#
# ROBOTGAME is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# ROBOTGAME is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# ROBOTGAME. If not, see .
#
# ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
#
# robotgame.py
# --------------------
# date created : Tue Aug 7 2012
# copyright : (C) 2012 Sakse Dalum
# maintained by : Sakse Dalum
"""
The main entrance point.
"""
from __future__ import print_function
import sys
import pygame
# Initialise all Pygame modules
pygame.init()
# Check if critical Pygame modules were initialised properly before continuing.
module_names = ['display', 'mixer']
for module_name in module_names:
module = getattr(pygame, module_name)
if not module.get_init():
print("Failed to initialise %s module." % module_name)
sys.exit()
if not pygame.image.get_extended():
print("Pygame does not support extended image support.")
sys.exit()
import argparse
import robotgame
if __name__ == '__main__':
# Parse command-line arguments
parser = argparse.ArgumentParser()
parser.add_argument('-r',
'--resolution',
type=str,
default="800x600",
help="specifies the resolution of the game")
parser.add_argument('-f',
'--fullscreen',
action='store_const',
const=True,
default=False,
help="specifies the resolution of the game")
args = vars(parser.parse_args())
resolution = tuple([int(x) for x in args['resolution'].split('x')])
fullscreen = bool(args['fullscreen'])
print("Display width: %d, display height: %d, fullscreen: %s"
% (resolution[0], resolution[1], fullscreen))
window = pygame.display.set_mode(resolution,
pygame.FULLSCREEN if fullscreen else 0)
game = robotgame.game.Game(window)
game.start()