Module hotspot

Provides a hotspot with focus tracking.

Info:

  • License: GPL v3
  • Author: Wesley Werner

Functions

module:new (args) Creates a new instance.
update (dt) Placeholder function.
mousemoved (x, y, dx, dy, istouch) Process mouse/touch movement.
mousepressed (x, y, button, istouch) Process pressed clicks/touches.
mousereleased (x, y, button, istouch) Process click/touch releases.
testFocus (x, y) Tests if a point is over the element.
draw () Placeholder function.

Tables

args A table of arguments for new hotspots.
instance Lists properties available on the instance.


Functions

module:new (args)
Creates a new instance.

Parameters:

  • args args A table of arguments.

Returns:

    instance
update (dt)
Placeholder function. This element does not process any updates

Parameters:

  • dt number delta time as given by Love
mousemoved (x, y, dx, dy, istouch)
Process mouse/touch movement. Call this from your main loop so the element knows when it has focus, which flags the "focused" property true.

Parameters:

  • x
  • y
  • dx
  • dy
  • istouch
mousepressed (x, y, button, istouch)
Process pressed clicks/touches. Call this from your main loop so the element knows when it is pressed on, which flags the "down" property true.

Parameters:

  • x
  • y
  • button
  • istouch
mousereleased (x, y, button, istouch)
Process click/touch releases. Call this from your main loop so the element knows when a press is released from it, which flags the "down" property false and fires the "callback" function if it is present.

Parameters:

  • x
  • y
  • button
  • istouch
testFocus (x, y)
Tests if a point is over the element. Used internally by mousemoved

Parameters:

  • x number The x position to test against
  • y number The y position to test against

Returns:

    bool true if the point is over the element
draw ()
Placeholder function. This element does not draw anything, this is user controlled

Tables

args
A table of arguments for new hotspots. In addition to the mentioned parameters, you can add any other keys you want. All keys are copied to the hotspot instance, which allows you to access them later through the instance.

Fields:

  • left number The left screen position.
  • top number The top screen position.
  • width number The width in pixels.
  • height number The height in pixels.
instance
Lists properties available on the instance.

Fields:

  • focused bool true while the focus is over the hotspot. This is determined while you call mousemoved
  • down bool true while a click/touch is pressed on the hotspot. This is determined while you call mousepressed
  • left number The x position
  • top number The y position
  • width number The width of the element
  • height number The height of the element
generated by LDoc 1.4.6 Last updated 2018-01-03 16:24:23