comparison eosd @ 334:4eca6130f118

Add options to set FPS limit and disable double buffering
author Thibaut Girka <thib@sitedethib.com>
date Sun, 01 Jul 2012 01:07:41 +0200
parents d369a369204a
children bc162f60f0a0
comparison
equal deleted inserted replaced
333:d369a369204a 334:4eca6130f118
47 self.players_bullets = [bullet for bullet in self.players_bullets if bullet.frame > 1] 47 self.players_bullets = [bullet for bullet in self.players_bullets if bullet.frame > 1]
48 EoSDGame.cleanup(self) 48 EoSDGame.cleanup(self)
49 49
50 50
51 51
52 def main(path, data, stage_num, rank, character, replay, boss_rush): 52 def main(path, data, stage_num, rank, character, replay, boss_rush, fps_limit, single_buffer):
53 resource_loader = Loader(path) 53 resource_loader = Loader(path)
54 resource_loader.scan_archives(data) 54 resource_loader.scan_archives(data)
55 55
56 if stage_num is None: 56 if stage_num is None:
57 story = True 57 story = True
69 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] 69 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1]
70 states = [PlayerState(character=character, power=default_power)] 70 states = [PlayerState(character=character, power=default_power)]
71 71
72 game_class = EoSDGameBossRush if boss_rush else EoSDGame 72 game_class = EoSDGameBossRush if boss_rush else EoSDGame
73 73
74 runner = GameRunner(resource_loader) 74 runner = GameRunner(resource_loader, fps_limit=fps_limit, double_buffer=(not single_buffer))
75 while True: 75 while True:
76 if replay: 76 if replay:
77 level = replay.levels[stage_num - 1] 77 level = replay.levels[stage_num - 1]
78 if not level: 78 if not level:
79 raise Exception 79 raise Exception
129 parser.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra).') 129 parser.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra).')
130 parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') 130 parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).')
131 parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).') 131 parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).')
132 parser.add_argument('--replay', metavar='REPLAY', help='Select a replay') 132 parser.add_argument('--replay', metavar='REPLAY', help='Select a replay')
133 parser.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses') 133 parser.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses')
134 parser.add_argument('--single-buffer', action='store_true', help='Disable double buffering')
135 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit')
134 136
135 args = parser.parse_args() 137 args = parser.parse_args()
136 138
137 main(args.path, tuple(args.data), args.stage, args.rank, args.character, args.replay, args.boss_rush) 139 main(args.path, tuple(args.data), args.stage, args.rank, args.character,
140 args.replay, args.boss_rush, args.fps_limit, args.single_buffer)