deploy: 5a1ec672a7
This commit is contained in:
@@ -9,6 +9,91 @@ _The Display maintains its own terminal buffer and can be manipulated using fami
|
||||
|
||||
Extends: `VisualElement`
|
||||
|
||||
## Usage
|
||||
```lua run
|
||||
-- Create a display for a custom terminal
|
||||
```
|
||||
|
||||
```lua run
|
||||
local display = main:addDisplay()
|
||||
```
|
||||
|
||||
```lua run
|
||||
:setSize(30, 10)
|
||||
```
|
||||
|
||||
```lua run
|
||||
:setPosition(2, 2)
|
||||
```
|
||||
|
||||
```lua run
|
||||
|
||||
```
|
||||
|
||||
```lua run
|
||||
-- Get the window object for CC API operations
|
||||
```
|
||||
|
||||
```lua run
|
||||
local win = display:getWindow()
|
||||
```
|
||||
|
||||
```lua run
|
||||
|
||||
```
|
||||
|
||||
```lua run
|
||||
-- Use standard CC terminal operations
|
||||
```
|
||||
|
||||
```lua run
|
||||
win.setTextColor(colors.yellow)
|
||||
```
|
||||
|
||||
```lua run
|
||||
win.setBackgroundColor(colors.blue)
|
||||
```
|
||||
|
||||
```lua run
|
||||
win.clear()
|
||||
```
|
||||
|
||||
```lua run
|
||||
win.setCursorPos(1, 1)
|
||||
```
|
||||
|
||||
```lua run
|
||||
win.write("Hello World!")
|
||||
```
|
||||
|
||||
```lua run
|
||||
|
||||
```
|
||||
|
||||
```lua run
|
||||
-- Or use the helper method
|
||||
```
|
||||
|
||||
```lua run
|
||||
display:write(1, 2, "Direct write", colors.red, colors.black)
|
||||
```
|
||||
|
||||
```lua run
|
||||
|
||||
```
|
||||
|
||||
```lua run
|
||||
-- Useful for external APIs
|
||||
```
|
||||
|
||||
```lua run
|
||||
local paintutils = require("paintutils")
|
||||
```
|
||||
|
||||
```lua run
|
||||
paintutils.drawLine(1, 1, 10, 1, colors.red, win)
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|
||||
Reference in New Issue
Block a user