From dbfa91dc28b1dcc54699a1601c980bd74454be32 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Mon, 18 Jul 2022 14:16:29 +0200 Subject: [PATCH] Update Basalt.md --- docs/objects/Basalt.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/objects/Basalt.md b/docs/objects/Basalt.md index 6562404..e095382 100644 --- a/docs/objects/Basalt.md +++ b/docs/objects/Basalt.md @@ -78,6 +78,13 @@ Calls the draw and event handler once - this gives more flexibility about which #### Usage: * Creates and starts a custom update cycle +```lua +local mainFrame = basalt.createFrame() +local aButton = mainFrame:addButton():setPosition(2,2) +while true do + basalt.update(os.pullEventRaw()) +end +``` ## basalt.stopUpdate Stops the automatic draw and event handler which got started by basalt.autoUpdate() @@ -104,7 +111,14 @@ Checks if the user is currently holding a key #### Usage: * Shows a debug message with true or false if the left ctrl key is down, as soon as you click on the button. - +```lua +local mainFrame = basalt.createFrame() +local aButton = mainFrame:addButton():setPosition(2,2):setText("Check Ctrl") +aButton:onClick(function() + basalt.debug(basalt.isKeyDown(keys.leftCtrl)) +end) +basalt.autoUpdate() +``` ## basalt.debug creates a label with some information on the main frame on the bottom left, if you click on that label it will open a log view for you. See it as the new print for debugging