Class: Hokusai::Backends::RaylibBackend::Config

Inherits:
Object
  • Object
show all
Defined in:
ui/src/hokusai/backends/raylib/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'ui/src/hokusai/backends/raylib/config.rb', line 10

def initialize
  @width = 500
  @height = 500
  @fps = 60
  @title = "(Unknown Title)"
  @config_flags = Raylib::FLAG_WINDOW_RESIZABLE | Raylib::FLAG_VSYNC_HINT
  @window_state_flags = Raylib::FLAG_WINDOW_RESIZABLE
  @automation_driver = nil
  @background = Raylib::WHITE
  @after_load_cb = nil
  @host = "127.0.0.1"
  @port = 4333
  @automated = false
  @on_reload = ->(_){}
  @event_waiting = false
end

Instance Attribute Details

#after_load_cbObject

Returns the value of attribute after_load_cb.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def after_load_cb
  @after_load_cb
end

#automatedObject

Returns the value of attribute automated.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def automated
  @automated
end

#automation_driverObject

Returns the value of attribute automation_driver.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def automation_driver
  @automation_driver
end

#backgroundObject

Returns the value of attribute background.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def background
  @background
end

#config_flagsObject

Returns the value of attribute config_flags.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def config_flags
  @config_flags
end

#event_waitingObject

Returns the value of attribute event_waiting.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def event_waiting
  @event_waiting
end

#fpsObject

Returns the value of attribute fps.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def fps
  @fps
end

#heightObject

Returns the value of attribute height.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def height
  @height
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def host
  @host
end

#on_reload(&block) ⇒ Object

Returns the value of attribute on_reload.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def on_reload
  @on_reload
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def port
  @port
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def title
  @title
end

#widthObject

Returns the value of attribute width.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def width
  @width
end

#window_state_flagsObject

Returns the value of attribute window_state_flags.



5
6
7
# File 'ui/src/hokusai/backends/raylib/config.rb', line 5

def window_state_flags
  @window_state_flags
end

Instance Method Details

#after_load(&block) ⇒ Object



39
40
41
# File 'ui/src/hokusai/backends/raylib/config.rb', line 39

def after_load(&block)
  self.after_load_cb = block
end

#automate(host, port) ⇒ Object



33
34
35
36
37
# File 'ui/src/hokusai/backends/raylib/config.rb', line 33

def automate(host, port)
  self.host = host
  self.port = port
  self.automated = true
end

#start_automation_driverObject

Raises:



27
28
29
30
31
# File 'ui/src/hokusai/backends/raylib/config.rb', line 27

def start_automation_driver
  raise ConfigError.new("Need a Hokusai::Driver in order to automate") if automation_driver.nil?

  automation_driver.serve(host, port)
end