17
17
from optparse import OptionParser
18
18
sys.path.append(".")
19
from magicor import GameEngine, getConfig
19
from magicor import GameEngine, getConfig, parse_printkeys
20
20
from magicor.states.intro import CopyrightNoticeState
22
22
parser = OptionParser(usage="%prog [options]")
33
33
baseConf="~/.magicor/magicor.conf"
35
35
parser.add_option("-j", "--joystick",
36
action="store", type="int", dest="joystick", default=None,
36
action="store", type="int", dest="joystick",
37
38
help="enable/disable joystick")
38
39
parser.add_option("-m", "--music",
39
action="store", type="int", dest="music", default=None,
40
action="store", type="int", dest="music",
40
42
help="enable/disable music")
41
43
parser.add_option("-s", "--sound",
42
action="store", type="int", dest="sound", default=None,
44
action="store", type="int", dest="sound",
43
46
help="enable/disable sound")
44
47
parser.add_option("-f", "--fullscreen",
45
action="store", type="int", dest="fullscreen", default=None,
48
action="store", type="int", dest="fullscreen",
46
50
help="enable/disable fullscreen")
51
parser.add_option("-d","--dev", type="int", dest= "devmode",
52
default=None, help="enable dev keys")
53
parser.add_option("-k","--keysprintdbg",type="string", dest="printkeys",default="",help="keys to enable selective printing of debug info. Separator is ':'")
47
54
(options, args) = parser.parse_args()
49
56
paths = [ options.configPath, baseConf ]
54
61
conf["data_path"]='data'
56
63
if options.joystick != None:
57
conf["joystick"] = options.joystick
64
conf["joystick"] = bool(options.joystick)
58
65
if options.music != None:
59
66
conf["music"] = options.music
60
67
if options.sound != None:
61
68
conf["sound"] = options.sound
62
69
if options.fullscreen != None:
63
conf["fullscreen"] = options.fullscreen
70
conf["fullscreen"] = bool(options.fullscreen)
71
if options.devmode != None:
72
conf["devmode"] = bool(options.devmode)
73
parse_printkeys(options.printkeys)
64
74
gameEngine = GameEngine(conf)
65
75
gameEngine.start(CopyrightNoticeState(conf, None, gameEngine.screen))