Small Update

- Fixed MonitorFrame
- Added MonitorFrame Docs
This commit is contained in:
Robert Jelic
2023-05-03 19:50:35 +02:00
parent 6c235b04df
commit 4b2d417d75
9 changed files with 190 additions and 32 deletions

View File

@@ -0,0 +1,10 @@
MonitorFrame is a subclass of the BaseFrame class. It is specifically designed for use with in-game monitors, allowing you to display content on monitors and manage multiple monitor groups. MonitorFrame inherits all methods from BaseFrame and provides additional functionality for working with in-game monitors.
To create a MonitorFrame, you can use the basalt.addMonitor() function.
In addition to the Object, VisualObject, Container, and BaseFrame methods, MonitorFrame also has the following methods:
| | |
|---|---|
|[setMonitor](objects/MonitorFrame/setMonitor.md)|Sets the in-game monitor to display the MonitorFrame content
|[setMonitorGroup](objects/MonitorFrame/setMonitorGroup.md)|Sets the monitor group for managing multiple monitors

View File

@@ -0,0 +1,38 @@
## setMonitor
### Description
Associates the MonitorFrame with an in-game monitor. The content of the MonitorFrame will be displayed on the specified monitor.
### Parameters
1. `string|table` the monitor object or name
### Returns
1. `object` The object in use
### Usage
* Creates a MonitorFrame and associates it with a monitor:
```lua
local basalt = require("basalt")
local monitor = peripheral.wrap("top") -- Assuming a monitor is on the top side
local monitorFrame = basalt.addMonitor()
monitorFrame:setMonitor(monitor)
basalt.autoUpdate()
```
or
```lua
local basalt = require("basalt")
local monitorFrame = basalt.addMonitor()
monitorFrame:setMonitor("top")
basalt.autoUpdate()
```

View File

@@ -0,0 +1,41 @@
## setMonitorGroup
### Description
Sets the monitor group for the MonitorFrame. This can be used to combine multiple in-game monitors into a single large monitor. The content of the MonitorFrame will be displayed across all monitors in the group.
### Parameters
1. `table` A table containing monitor names connected to the computer, organized by their position in the group.
Table Layout:
```lua
{
[y1] = {"x1", "x2", "x3"}
[y2] = {"x1", "x2", "x3"}
}
```
### Returns
1. `object` The object in use
### Usage
* Creates a MonitorFrame and combines two monitors into a single large monitor:
```lua
local basalt = require("basalt")
local monitorFrame = basalt.addMonitor()
local monitorGroup = {
[1] = {"monitor_1", "monitor_2"},
[2] = {"monitor_3", "monitor_4"}
}
monitorFrame:setMonitorGroup(monitorGroup)
basalt.autoUpdate()
```