Skip to content

class Config public

Configure the properties of a hokusai pocket app Set config flags, fps, title, and register assets. Passed as a callback parameter to Hokusai::Backend.run

#width=(value) public

Set the width of the window on load

Arguments

  • value - The window pixel width (Integer)

#height=(value) public

Set the height of the window on load

Arguments

  • value - The window pixel height (Integer)

#fps=(value) public

Set the desired frame rate (frames per second)

Arguments

  • value - The frames per second (Integer)

#title=(value) public

Set the title of the window

Arguments

  • value - The title of the window (String)

#config_flags=(value) public

Set any config flags for the window

Arguments

  • value - A union of HP_FLAG_*

Examples

ruby
Hokusai::Backend.run(App) do |config|
  config.config_flags = HP_FLAG_VSYNC_HINT | HP_FLAG_WINDOW_RESIZABLE
end
# configures window to be resizable and sync frame rate with monitor

#event_waiting=(value) public

Set if application should pause rendering until an event comes through

Arguments

  • value - a boolean (false to turn off event waiting)

#draw_fps=(value) public

Set if the application should draw the FPS in the top left corner

Arguments

  • value - true to draw FPS

#log=(value) public

Set if the application should log to stdout

Note LOG_LEVEL env var can be set to filter logging

Arguments

  • value - true to log

#audio=(value) public

Accessor to toggle audio (default false)

Arguments

  • value - true to use audio

#touch=(value) public

Accessor to toggle touch input handling (default false)

Arguments

  • value - true to use touch events

#start_automation_driver internal

Not implemented

#automate internal

Not implemented

#after_load(&block) public

Called after the OpenGL context is established.

This is the place to register assets which depend on the GPU

Arguments

  • block - a callback to run code after an OpenGL window is established

Examples

ruby
Hokusai::Backend.run(App) do |config|
  config.after_load do
    Hokusai.fonts.register "default", Hokusai::Backend::Font.default
  end
end

Returns

Returns nothing.

#hot_reload=(entrypoint) public

Sets hot reload entypoint (should probably be same as the app entrypoint)

Note: for best results, also set `event_waiting = false`

Arguments

  • entrypoint - the file path to watch

Returns

Returns nothing.

#on_reload internal

Used by hot_reload= to set the reload logic