Class: Hokusai::Backends::SDLBackend::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 13

def initialize
  @width = 500
  @height = 500
  @fps = 60

  @init_flags = ::SDL::INIT_VIDEO | ::SDL::INIT_EVENTS
  @window_config_flags = SDL::WINDOW_RESIZABLE
  @title = "(Unknown Title)"
  @background = SDLBackend.color(255,255,255, 0)

  after_load do
    font = Hokusai::Backends::SDLBackend::Font.from "#{__dir__}/Monaco.ttf"
    Hokusai.fonts.register "default", font
    Hokusai.fonts.activate "default"
  end
end

Instance Attribute Details

#after_load_cbObject

Returns the value of attribute after_load_cb.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def after_load_cb
  @after_load_cb
end

#automatedObject

Returns the value of attribute automated.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def automated
  @automated
end

#automation_driverObject

Returns the value of attribute automation_driver.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def automation_driver
  @automation_driver
end

#backgroundObject

Returns the value of attribute background.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def background
  @background
end

#fpsObject

Returns the value of attribute fps.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def fps
  @fps
end

#heightObject

Returns the value of attribute height.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def height
  @height
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def host
  @host
end

#init_flagsObject

Returns the value of attribute init_flags.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def init_flags
  @init_flags
end

#portObject

Returns the value of attribute port.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def port
  @port
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def title
  @title
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def width
  @width
end

#window_config_flagsObject

Returns the value of attribute window_config_flags.



4
5
6
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 4

def window_config_flags
  @window_config_flags
end

Instance Method Details

#after_load(&block) ⇒ Object



9
10
11
# File 'ui/src/hokusai/backends/sdl2/config.rb', line 9

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