From 2f750e283697175eca4e54dcac59de172f3d689d Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Mon, 21 Apr 2025 08:30:49 +0200 Subject: [PATCH] Added monitor usage to getting-started --- docs/guides/getting-started.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/guides/getting-started.md b/docs/guides/getting-started.md index 67b709c..7ba6820 100644 --- a/docs/guides/getting-started.md +++ b/docs/guides/getting-started.md @@ -76,6 +76,30 @@ element:onChange(function(self, value) 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 - Check out the [Examples](https://github.com/Pyroxenium/Basalt2/tree/main/examples) for more complex UIs