SpriteAnimation.lua
Tile.lua
Neo3D.lua
QuadTree.lua
Widget.lua
Sprite.lua
Collision.lua
OEntity.lua
Button.lua
Graphics2D.lua
InputField.lua
LuaUnit.lua
Tests.lua
OCamera.lua
Object3d.lua
class.lua
OLight.lua
SpriteSheet.lua
OSound.lua
Utils.lua
Canvas.lua
Label.lua
Api.lua

The Button class

The Button class contains primitives to display and configure
UI based buttons. You can specify a callback that will be called when the button is pressed.

See also: Widget

Example:


-- The button callback
function button_callback()
     print("Button pressed!")
end

-- Create a button
button = Button(10, 10, 100, 20, "This is a button!", "button_callback")

-- Add it to the main canvas
mainCanvas:addWidget(button)

Button(x,y,w,h,text,callback)

Creates a new button.

Parameter

x

The x position on the canvas

y

The y position on the canvas

w

The width of the widget

h

The height of the widget

text

The label of the widget

callback

(optional) The callback of the button