Skip to content

drawable

Represents menu drawable object

Properties

Type Name Description
function(x, y) paint Paint callback
function(x, y) update Update callback
number size_x Current width
number size_y Current height
number pos_x Current X pos
number pos_y Current Y pos
number margin_x Current margin (X)
number margin_y Current margin (Y)
string text Text to draw

Methods

draw()

Draws the object

1
drw:draw()

attach(other)

Type Name Description Default
drawable other Drawable to attach this one to none

Attaches currect drawable object to another

1
drw:attach(other_drw)

detach(other)

Type Name Description Default
drawable other Drawable to detach this one from none

Detaches current drawable object from another

1
drw:detach(other_drw)

set_size(w, h)

Type Name Description Default
number w New width none
number h New height none

Updates the size

1
drw:set_size(200, 300)

get_size(): number, number

Returns current width and height

1
local w, h = drw:get_size()

set_margin(x, y)

Type Name Description Default
number x New margin X none
number y New margin Y none

Updates the margin

1
drw:set_margin(5, 5)

get_margin(): number, number

Returns current margin's x and y

1
local x, y = drw:get_margin()

is_visible(): bool

Returns if object is visible

1
2
if drw:is_visible() then
end

set_visible(v)

Type Name Description Default
bool v Visibility none

Updates visibility

1
drw:set_visible(false)

get_pos(): number, number

Returns current x and y

1
local x, y = drw:get_pos()

set_pos(x, y)

Type Name Description Default
number x New X none
number y New Y none

Updates currect position

1
drw:set_pos(50, 50)

is_attached(other): bool

Type Name Description Default
drawable other Drawable to check none

Returns true if current drawable is attached to other drawable

1
2
if drw:is_attached(other_drw) then
end