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

#voice=(value) public ​

Accessor to toggle voice / speech control

When on can use voice control.

Arguments ​

  • value - true to use voice

#speech=(value) public ​

Accessor to set speech TTS output

When on, can use [Hokusai.speak](/api/Hokusai.html#speak)

Arguments ​

  • value - true to use speech output

#voice_model_path=(value) public ​

Accessor to set the model path for the embedded whisper.cpp library

(Note: Can download with `hokusai-pocket voice-assets`)

Arguments ​

  • value - path to model (String)

#voice_accessibility=(value) public ​

Accessor to toggle accessibility controls

Arguments ​

  • value - true to use voice accessibility

#voice_accessibility_hot_key=(value) public ​

Accessor to set the hot key which enables voice control

Arguments ​

  • value - One of the following symbols :apostrophe | :comma | :minus | :period | :slash | :zero | :one | :two | :three | :four | :five | :six | :seven | :eight | :nine | :semicolon | :equal | :a | :b | :c | :d | :e | :f | :g | :h | :i | :j | :k | :l | :m | :n | 😮 | :p | :q | :r | 😒 | :t | :u | :v | :w | :x | :y | 😒 | :left_bracket | :backslash | :right_bracket | :grave | :space | :escape | :enter | :tab | :backspace | :insert | :delete | :right | :left | :down | :up | :page_up | :page_down | :home | :end | :caps_lock | :scroll_lock | :num_lock | :print_screen | :pause | :f1 | :f2 | :f3 | :f4 | :f5 | :f6 | :f7 | :f8 | :f9 | :f10 | :f11 | :f12 | :left_shift | :left_control | :left_alt | :left_super | :right_shift | :right_control | :right_alt | :right_super | :kb_menu | :kp_0 | :kp_1 | :kp_2 | :kp_3 | :kp_4 | :kp_5 | :kp_6 | :kp_7 | :kp_8 | :kp_9 | :kp_decimal | :kp_divide | :kp_multiply | :kp_subtract | :kp_add | :kp_enter | :kp_equal | :back | :menu | :volume_up | :volume_down

#voice_accessibility_hot_key_type=(value) public ​

Accessor to set accessibility hot key type (default: toggle)

Note: Only :toggle is currently supported.

Arguments ​

  • value - one of the following symbols :toggle | :hold

#voice_accessibility_hot_key_modifiers=(value) public ​

Accessor to set any hot key modifiers. (Not implemented)

Arguments ​

  • value - an array containing one or more of the following values (:control, :shift, :super, :alt)

#accessibility(&block) public ​

Shortcut method for configuring accessibility options.

Automatically sets voice and audio to `true`

Arguments ​

  • block - a callback to set the following props [:model_path, :hot_key, :hot_key_type, :hot_key_modifiers]

Examples ​

ruby
Hokusai::Backend.run(App) do |config|
  config.accessibility do |aconig|
    aconfig.model_path = "assets/models/ggml-tiny.bin"
    aconfig.hot_key = :space
  end
end

#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