Skip to content

Commit

Permalink
add scale to lr
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisKolganov committed Sep 5, 2018
1 parent a7987c8 commit 67b7df8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions madcars/Runners/localrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
from mechanic.game import Game
from mechanic.strategy import KeyboardClient, FileClient

window = pyglet.window.Window(1200, 800, vsync=False)
draw_options = pymunk.pyglet_util.DrawOptions()
_ = pyglet.clock.ClockDisplay(interval=0.016)

maps = ['PillMap', 'PillHubbleMap', 'PillHillMap', 'PillCarcassMap', 'IslandMap', 'IslandHoleMap']
cars = ['Buggy', 'Bus', 'SquareWheelsBuggy']

games = [','.join(t) for t in product(maps, cars)]


parser = argparse.ArgumentParser(description='LocalRunner for MadCars')
Expand All @@ -24,16 +26,20 @@
help='Path to executable with strategy for second player', default='keyboard')
parser.add_argument('--spl', type=str, nargs='?', help='Path to log for second player')

parser.add_argument('-m', '--matches', nargs='+', help='List of pairs(map, car) for games', default=games)

maps = ['PillMap', 'PillHubbleMap', 'PillHillMap', 'PillCarcassMap', 'IslandMap', 'IslandHoleMap']
cars = ['Buggy', 'Bus', 'SquareWheelsBuggy']
games = [','.join(t) for t in product(maps, cars)]

parser.add_argument('-S', '--scale', type=float, help='Window scale', default=1)

parser.add_argument('-m', '--matches', nargs='+', help='List of pairs(map, car) for games', default=games)

args = parser.parse_args()

scale = args.scale

window = pyglet.window.Window(1200 * scale, 800 * scale, vsync=False)
draw_options = pymunk.pyglet_util.DrawOptions()
_ = pyglet.clock.ClockDisplay(interval=0.016)
pyglet.gl.glScalef(scale, scale, scale)

first_player = args.fp
second_player = args.sp

Expand All @@ -55,10 +61,9 @@

@window.event
def on_draw():
pyglet.gl.glClearColor(255,255,255,255)
pyglet.gl.glClearColor(255, 255, 255, 255)
window.clear()
game.draw(draw_options)
game.tick()
if not game.game_complete:
future_message = loop.run_until_complete(game.tick())
else:
Expand Down

0 comments on commit 67b7df8

Please sign in to comment.