Naev

Module luatk

Intersection of scissors with the current applied ones.

Functions

isOpen () Gets whether or not the luatk has a window open.
run () Runs the luatk.
vn (setup) Creates a custom state inside a vn state.
close () Closes the toolkit and all windows.
rerender () Forces the toolkit to rerender.
setDefaultFont (font) Sets the default font to use for the toolkit.
update (dt) Updates the luatk toolkit.
mousepressed (mx, my, button) Handles mouse clicks.
mousereleased (mx, my, button) Handles mouse releases
mousemoved (mx, my, dx, dy) Handles mouse motion.
keypressed (key) Handles key presses.
textinput (str) Handles text input.
wheelmoved (mx, my) Wheel moved event.
newWindow (x, y, w, h) Creates a new window.
luatk.Window:resize (w, h) Resizes the window, recentering if necessary.
luatk.Window:setUpdate (f) Sets a custom function to be run each window update.
luatk.Window:destroy () Destroys a window.
luatk.Window:setAccept (func) Sets the accept function to be run when enter is pressed.
luatk.Window:setCancel (func) Sets the cancel function to be run when escape is pressed.
luatk.Window:setKeypress (func) Sets a function to handle key input to the window.
luatk.Window:getDimensions () Gets the dimensions of the window.
luatk.Window:setFocus (wgt) Sets the focused widget of a window.
luatk.Window:setFocusLock (state) Locks the focus for a window to whatever widget is being currently focused.
luatk.Button:enable () Enables a button widget.
luatk.Button:disable () Disables a button widget.
luatk.Button:setAlt (alt) Sets the alt text of a button.
luatk.Text:set (text) Changes the text of the text widget.
luatk.Text:height () Gets the height of the text widget text.
luatk.Text:width () Gets the maximum width of the text widget text.
luatk.Text:dimensions () Gets the dimensions of the text widget text.


Functions

isOpen ()
Gets whether or not the luatk has a window open.
run ()
Runs the luatk. Should be used after the windows are set up.
vn (setup)
Creates a custom state inside a vn state.

A full example is shown below. `` vn.clear() vn.scene() vn.transition() vn.na("This is a test") luatk.vn( function () local wdw = luatk.msgInput( "Test", "Just a test", 50, function( str )

  print( str )

end ) end ) vn.na("That was all!") vn.run() ``

Parameters:

  • setup function Function to set up the luatk.
close ()
Closes the toolkit and all windows.
rerender ()
Forces the toolkit to rerender.
setDefaultFont (font)
Sets the default font to use for the toolkit.

Parameters:

  • font font Font to set as default.
update (dt)
Updates the luatk toolkit.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • dt number Number of seconds since last update.
mousepressed (mx, my, button)
Handles mouse clicks.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse click.
  • my number Y coordinates of the mouse click.
  • button integer Number of the button pressed.

Returns:

    boolean true if the event was used, false otherwise.
mousereleased (mx, my, button)
Handles mouse releases Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse released position.
  • my number Y coordinates of the mouse released position.
  • button integer Number of the button released.

Returns:

    boolean true if the event was used, false otherwise.
mousemoved (mx, my, dx, dy)
Handles mouse motion.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse released position.
  • my number Y coordinates of the mouse released position.
  • dx number Relative X motion from last event.
  • dy number Relative Y motion from last event.

Returns:

    boolean true if the event was used, false otherwise.
keypressed (key)
Handles key presses.

Parameters:

  • key

Returns:

    string key Name of the key pressed.
textinput (str)
Handles text input.

Parameters:

  • str

Returns:

    string key Name of the key pressed.
wheelmoved (mx, my)
Wheel moved event.

Parameters:

  • mx number Mouse x wheel movement.
  • my number Mouse y wheel movement.
newWindow (x, y, w, h)
Creates a new window.

Parameters:

  • x number or nil X position of the window or nil to center.
  • y number or nil Y position of the window or nil to center.
  • w number Width to set the window to.
  • h number Height to set the window to.

Returns:

    luatk.Window A new luatk window.
luatk.Window:resize (w, h)
Resizes the window, recentering if necessary.

Parameters:

  • w number Width to set the window to.
  • h number Height to set the window to.
luatk.Window:setUpdate (f)
Sets a custom function to be run each window update.

Parameters:

  • f function or nil Custom function to set. nil disables.
luatk.Window:destroy ()
Destroys a window.
luatk.Window:setAccept (func)
Sets the accept function to be run when enter is pressed.

Parameters:

  • func function Function to set.
luatk.Window:setCancel (func)
Sets the cancel function to be run when escape is pressed.

Parameters:

  • func function Function to set.
luatk.Window:setKeypress (func)
Sets a function to handle key input to the window.

Parameters:

  • func function Function to set.
luatk.Window:getDimensions ()
Gets the dimensions of the window.

Returns:

  1. number Width of the window.
  2. number Height of the window.
luatk.Window:setFocus (wgt)
Sets the focused widget of a window.

Parameters:

  • wgt Widget Widget to focus.
luatk.Window:setFocusLock (state)
Locks the focus for a window to whatever widget is being currently focused.

Parameters:

  • state boolean Whether to enable or disable the focus lock.
luatk.Button:enable ()
Enables a button widget.
luatk.Button:disable ()
Disables a button widget.
luatk.Button:setAlt (alt)
Sets the alt text of a button.

Parameters:

  • alt
luatk.Text:set (text)
Changes the text of the text widget.

Parameters:

  • text string Text to set widget to.
luatk.Text:height ()
Gets the height of the text widget text.

Returns:

    number Height of the text in the widget.
luatk.Text:width ()
Gets the maximum width of the text widget text.

Returns:

    number Width of the text in the widget.
luatk.Text:dimensions ()
Gets the dimensions of the text widget text.

Returns:

  1. number Width of the text in the widget.
  2. number Height of the text in the widget.
generated by LDoc 1.5.0 Last updated 2024-12-21 14:15:57