Lua in SpringRTS/Callins/MouseRelease()

From Wikibooks, open books for an open world
< Lua in SpringRTS‎ | Callins
Jump to navigation Jump to search



You need to return true on MousePress() to get MouseMove/MouseRelease directed to your widget.

Return values[edit]

x, y, button
where x is the cursor's position in the x axis and y the cursor position in the y axis. Position is relative to the screen, not the 3d world

Usage example[edit]

function widget:MousePress(x, y, button)
  echo("Mouse pressed")
  return true -- Pay attention to this. Without returning true the next function won't do anything

function widget:MouseRelease(x, y, button)
  echo("Mouse released")