Added monitor usage to getting-started
This commit is contained in:
@@ -76,6 +76,30 @@ element:onChange(function(self, value)
|
|||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using monitors instead
|
||||||
|
|
||||||
|
Basalt can render to monitors instead of the terminal. Here's how to use monitors:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local basalt = require("basalt")
|
||||||
|
|
||||||
|
-- Get a reference to the monitor
|
||||||
|
local monitor = peripheral.find("monitor")
|
||||||
|
-- Or specific side: peripheral.wrap("right")
|
||||||
|
|
||||||
|
-- Create frame for monitor
|
||||||
|
local monitorFrame = basalt.createFrame():setTerm(monitor) -- :setTerm is the important method here
|
||||||
|
|
||||||
|
-- Add elements like normal
|
||||||
|
monitorFrame:addButton()
|
||||||
|
:setText("Monitor Button")
|
||||||
|
:setWidth(24)
|
||||||
|
:setPosition(2, 2)
|
||||||
|
|
||||||
|
-- Start Basalt
|
||||||
|
basalt.run()
|
||||||
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
- Check out the [Examples](https://github.com/Pyroxenium/Basalt2/tree/main/examples) for more complex UIs
|
- Check out the [Examples](https://github.com/Pyroxenium/Basalt2/tree/main/examples) for more complex UIs
|
||||||
|
|||||||
Reference in New Issue
Block a user