Updated How To (markdown)
14
How-To.md
14
How-To.md
@@ -17,16 +17,16 @@ local basalt = dofile("basalt.lua")
|
||||
--Here you create a non-parent frame. The basalt.update/autoUpdate events will always give their events to a non-parent frame! Which means you always need atleast one active non-parent frame!
|
||||
--As variable you have to use a unique name - otherwise you wont get a frame object back. :show() immediatly shows the object on the screen
|
||||
local main = basalt.createFrame("mainFrame")
|
||||
main:show()
|
||||
main:show() -- now we make the main frame visible
|
||||
|
||||
local button = main:addButton("clickableButton")
|
||||
button:setPosition(4,4)
|
||||
button:setText("Click me!")
|
||||
local function buttonClick()
|
||||
local button = main:addButton("clickableButton") -- here we add a button to the main frame (with a unique name)
|
||||
button:setPosition(4,4) -- here we just change the position of that button (default position would be 1, 1)
|
||||
button:setText("Click me!") -- we set the text of that button
|
||||
local function buttonClick() -- we create a function which the button should call if we click on that button
|
||||
basalt.debug("I got clicked!")
|
||||
end
|
||||
button:onClick(buttonClick)
|
||||
button:show()
|
||||
button:onClick(buttonClick) -- here we add a onClick event and add the created function to the list
|
||||
button:show() -- ofc it also has to be visible
|
||||
|
||||
--Here you start the event listener.
|
||||
basalt.autoUpdate()
|
||||
|
||||
Reference in New Issue
Block a user