Module: Sc2::Client::ConfigurableOptions

Included in:
Sc2::Client, Sc2::Configuration
Defined in:
lib/sc2ai/local_play/client/configurable_options.rb

Overview

Attributes shared by Configuration and Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#data_dirString?

Override the path to find the data package.

Required if the binary is not in the standard versions folder location.

Launch param: -dataDir ../../

Returns:

  • (String, nil)


21
22
23
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 21

def data_dir
  @data_dir
end

#display_mode0, ...

Launch param: -displayMode

Returns:

  • (0, 1, nil)

    0 for window, 1 for fullscreen, nil for system default



66
67
68
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 66

def display_mode
  @display_mode
end

#egl_pathString?

Sets the path the to hardware rendering library.

Required for using the rendered interface with hardware rendering

Launch param: -eglpath

Example: /usr/lib/nvidia-384/libEGL.so

Returns:

  • (String, nil)


50
51
52
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 50

def egl_path
  @egl_path
end

#hostString?

Sc2 host param on which to listen for connections, default ‘127.0.0.1’

Launch param: -host 127.0.0.1

Returns:

  • (String, nil)


12
13
14
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 12

def host
  @host
end

#osmesa_pathString?

Sets the path the to software rendering library.

Required for using the rendered interface with software rendering

Launch param: -eglpath

Example: /usr/lib/x86_64-linux-gnu/libOSMesa.so

Returns:

  • (String, nil)


61
62
63
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 61

def osmesa_path
  @osmesa_path
end

#temp_dirString?

Override the path if you really need to set your own temp dir

Implicit default is /tmp/

Launch param: -tempDir ../../

Returns:

  • (String, nil)


39
40
41
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 39

def temp_dir
  @temp_dir
end

#verboseBoolean

If set to true, will send param to client.

Enables logging of all protocol requests/responses to std::err.

Launch param: -verbose

Returns:

  • (Boolean)


30
31
32
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 30

def verbose
  @verbose
end

#versionString?

Version number such as “4.10”. Leave blank to use latest

Returns:

  • (String, nil)


87
88
89
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 87

def version
  @version
end

#windowheightInteger

pixel height of game window

Returns:

  • (Integer)


74
75
76
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 74

def windowheight
  @windowheight
end

#windowwidthInteger

pixel width of game window

Returns:

  • (Integer)


70
71
72
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 70

def windowwidth
  @windowwidth
end

#windowxInteger

left position of window if windowed

Returns:

  • (Integer)


78
79
80
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 78

def windowx
  @windowx
end

#windowyInteger

top position of window if windowed

Returns:

  • (Integer)


82
83
84
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 82

def windowy
  @windowy
end

Instance Method Details

#load_default_launch_optionsObject

Resets configurable launch options to their defaults



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/sc2ai/local_play/client/configurable_options.rb', line 90

def load_default_launch_options
  @host = if Paths.wsl?
    "#{Socket.gethostname}.mshome.net"
  else
    "127.0.0.1" # -listen
  end

  @display_mode = 0 # -displayMode
  @windowwidth = nil # -windowwidth
  @windowheight = nil # -windowheight
  @windowx = nil # -windowx
  @windowy = nil # -windowy
  @verbose = false # -verbose

  # Linux
  @data_dir = nil # -dataDir '../../'
  @temp_dir = nil # -tempDir '/tmp/'
  @egl_path = nil # -eglpath '/usr/lib/nvidia-384/libEGL.so'
  @osmesa_path = nil # -osmesapath '/usr/lib/x86_64-linux-gnu/libOSMesa.so'

  @version = nil # calculates -dataVersion and Base% executable
end