The widget class
The widget class represents the base class for every widget.
It contains the most basic functionality shared by every widget type like
translating the position or changing the rotation.
Keep in mind that a Widget object does not refer to an existing C++ widget and is just used
to provide common methods for other Widget based classes!
Class members
widget: The native widget handle used by the C++ backend.
Do not write to these directly! Use the suitable methods for that!
Parameter
position[1]
position[2]
height
width
rotation
Widget(x,y,w,h,text)
Creates a new Widget object.
Parameter
x
y
w
h
text
function Widget:setScale(scale)
Sets the scale of the widget
Parameter
scale
function Widget:setPosition(x,y)
Sets the current position of the widget
Parameter
x
y
function Widget:setRotation(r)
Sets the current rotation of the widget
Parameter
r
function Widget:rotate(angle)
Rotates the widget by an angle.
Parameter
angle
function Widget:translate(x,y)
Translates the widget by the given coordinates relative to the current position.
Parameter
x
y
function Widget:getPosition()
Gets the current position of the widget.
Parameter
x
y
function Widget:getSize()
Returns the width and height of this object.
Return: A vec2 with the width and the height.
function Widget:getLabel()
Retrieves the current label of the widget.
Return: The label as a string.
function Widget:setLabel(label)
Changes the current label of the widget.
Parameter
label
function Widget:setVisible(value)
Changes the widget visibility
Parameter
value
function Widget:isVisible()
Returns if the widget is turned visible.
Return: A boolean value.