Skip to content

Commit

Permalink
Specify window sizes at launch.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 194939935
  • Loading branch information
tewalds committed May 11, 2018
1 parent 5a6871c commit 35d4603
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pysc2/bin/play_vs_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def host():
break

host_proc = run_config.start(extra_ports=ports, host=FLAGS.host,
timeout_seconds=300)
timeout_seconds=300, window_loc=(50, 50))
client_proc = run_config.start(extra_ports=ports, host=FLAGS.host,
connect=False)
connect=False, window_loc=(700, 50))

create = sc_pb.RequestCreateGame(
realtime=FLAGS.realtime, local_map=sc_pb.LocalMap(map_path=map_inst.path))
Expand Down
15 changes: 13 additions & 2 deletions pysc2/lib/sc_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class StarcraftProcess(object):

def __init__(self, run_config, exec_path, data_version=None,
full_screen=False, extra_args=None, verbose=False,
host=None, connect=True, timeout_seconds=None, **kwargs):
host=None, connect=True, timeout_seconds=None,
window_size=(640, 480), window_loc=(50, 50), **kwargs):
self._proc = None
self._controller = None
self._check_exists(exec_path)
Expand All @@ -72,8 +73,18 @@ def __init__(self, run_config, exec_path, data_version=None,
"-port", str(self._port),
"-dataDir", os.path.join(run_config.data_dir, ""),
"-tempDir", os.path.join(self._tmp_dir, ""),
"-displayMode", "1" if full_screen else "0",
]
if full_screen:
args += ["-displayMode", "1"]
else:
args += [
"-displayMode", "0",
"-windowwidth", str(window_size[0]),
"-windowheight", str(window_size[1]),
"-windowx", str(window_loc[0]),
"-windowy", str(window_loc[1]),
]

if verbose or FLAGS.sc2_verbose:
args += ["-verbose"]
if data_version:
Expand Down

0 comments on commit 35d4603

Please sign in to comment.