Update Basalt.md

This commit is contained in:
Robert Jelic
2022-07-18 14:11:37 +02:00
committed by GitHub
parent 8157c025ea
commit 6ab840cb1c

View File

@@ -46,7 +46,6 @@ basalt.createFrame("myFirstFrame"):hide()
basalt.getFrame("myFirstFrame"):show() basalt.getFrame("myFirstFrame"):show()
``` ```
## basalt.getActiveFrame ## basalt.getActiveFrame
Returns the currently active base frame Returns the currently active base frame
@@ -70,7 +69,6 @@ local mainFrame = basalt.createFrame()
basalt.autoUpdate() basalt.autoUpdate()
``` ```
## basalt.update ## basalt.update
Calls the draw and event handler once - this gives more flexibility about which events basalt should process. For example you could filter the terminate event. Calls the draw and event handler once - this gives more flexibility about which events basalt should process. For example you could filter the terminate event.
@@ -80,14 +78,6 @@ Calls the draw and event handler once - this gives more flexibility about which
#### Usage: #### Usage:
* Creates and starts a custom update cycle * 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 ## basalt.stopUpdate
Stops the automatic draw and event handler which got started by basalt.autoUpdate() Stops the automatic draw and event handler which got started by basalt.autoUpdate()
@@ -97,11 +87,9 @@ Stops the automatic draw and event handler which got started by basalt.autoUpdat
```lua ```lua
local mainFrame = basalt.createFrame() local mainFrame = basalt.createFrame()
local aButton = mainFrame:addButton():setPosition(2,2):setText("Stop Basalt!") local aButton = mainFrame:addButton():setPosition(2,2):setText("Stop Basalt!")
aButton:onClick(function() aButton:onClick(function()
basalt.stopUpdate() basalt.stopUpdate()
end) end)
basalt.autoUpdate() basalt.autoUpdate()
``` ```
@@ -116,16 +104,7 @@ Checks if the user is currently holding a key
#### Usage: #### Usage:
* Shows a debug message with true or false if the left ctrl key is down, as soon as you click on the button. * 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 ## 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 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
@@ -151,7 +130,7 @@ Sets the base theme of the project! Make sure to cover all existing objects, oth
1. `table` theme layout look into [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for a example 1. `table` theme layout look into [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for a example
#### Usage: #### Usage:
* Creates a new base frame and adds a new theme which only changes the default color of buttons. * Sets the default theme of basalt.
```lua ```lua
basalt.setTheme({ basalt.setTheme({
ButtonBG = colors.yellow, ButtonBG = colors.yellow,
@@ -207,4 +186,4 @@ aButton:onClick(function()
aButton:setBackground(colors.gray) aButton:setBackground(colors.gray)
end) end)
end) end)
``` ```