SZI2019SmieciarzWmi/config.py

27 lines
713 B
Python
Raw Normal View History

import sys
import getopt
from sprites.cell import CELL_SIZE
def set_home_amount():
arguments = sys.argv[1:]
try:
optlist, args = getopt.getopt(arguments, '', ['home-count='])
for o, amount in optlist:
if o == '--home-count':
if int(amount) < 2:
print('Home count too low - must be higher than 2')
sys.exit(2)
return int(amount)
print('Missing argument: --home-count <amount>')
sys.exit(2)
except getopt.GetoptError as err:
print(err)
sys.exit(2)
home_amount = set_home_amount()
PLAY_WIDTH = home_amount*CELL_SIZE
PLAY_HEIGHT = PLAY_WIDTH