Skip to content

module Hokusai ​

.docker_template internal ​

Docker templates that get written to disk by binary

during cross platform publishing

.fonts public ​

Access the font registry

Returns ​

Returns a Hokusai::FontRegistry

.textures public ​

Access the texture registry

Returns ​

Returns a Hokusai::TextureRegistry

.images public ​

Access the image registry

Returns ​

Returns a Hokusai::ImageRegistry

.musics public ​

Access the music registry

Returns ​

Returns a Hokusai::MusicRegistry

.close_window public ​

close the current window

Returns ​

Returns nothing

.restore_window public ​

Restores the current window

Returns ​

Returns nothing

.minimize_window public ​

Minimizes the current window

Returns ​

Returns nothing

.maximize_window public ​

Maxmizes the current window

Returns ​

Returns nothing

.set_window_position(x, y) public ​

Sets the window position on the screen

Arguments ​

  • x - the screen's x coordinate
  • y - the screen's y coordinate

Returns ​

Returns nothing

.set_mouse_position(mouse) public ​

Sets the mouse position

Arguments ​

  • mouse - a Hokusai::Mouse with the position set.

.open_file(hash) public ​

Picks a file path to open using native file dialog

Arguments ​

  • hash - options for native file dialog
    • :filter - A comma delimited string of extensions to filter

Examples ​

ruby
if path = Hokusai.open_file(filter: "png,jpg,jpeg,gif")
  p File.read(path)
end

.save_file(hash) public ​

Picks a file path to save using native file dialog

Arguments ​

  • hash - options for native file dialog
    • :filter - A comma delimited string of extensions to filter

Examples ​

ruby
if path = Hokusai.save_file(filter: "txt,md")
  File.open(path, "w") { |io| io << "Hello" }
end

Returns ​

Returns nothing

.can_render(canvas) public ​

Tells if a canvas is renderable (useful for pruning unneeded renders)

Arguments ​

  • canvas - a Hokusai::Canvas

Returns ​

Returns a boolean

.on_set_mouse_cursor internal ​

Provides set mouse cursor callback

.set_mouse_cursor(type) public ​

Sets the mouse cursor from the available types:

Arguments ​

  • type - A symbol representing the type. can be one of [:default, :arrow, :ibeam, :crosshair, :pointer, :none]

.on_copy internal ​

Provides copy callback

.copy(text) public ​

Copies text to clipboard

Arguments ​

  • text - the text to copy (String)

Returns ​

Returns nothing

.on_paste internal ​

Sets the on paste callback

.paste public ​

Get text from clipboard

Returns ​

Returns a String or Nil

.on_exit(&block) public ​

Hook to perform actions on exit of the program.

Arguments ​

  • block - an exit callback

Returns ​

Returns nothing

.exit internal ​

Called on exit by the backend

.speak(words) public ​

Routes (words) through TTS

Arguments ​

  • words - a string to speak

Returns ​

Returns nothing

.copy_state internal ​

Copies state from one Hokusai::Block to another Hokusai::Block

Used in hot reloading to preserve state between reloads

You probably don't need this