Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Load the API
- os.loadAPI('/multiMon')
- --# Create the monitors object (the monitors are arranged in the world the same way you see them in the table below).
- local monitorSetup = {
- {peripheral.wrap('monitor_22'), peripheral.wrap('monitor_23'), peripheral.wrap('monitor_24')},
- {peripheral.wrap('monitor_25'), peripheral.wrap('monitor_26'), peripheral.wrap('monitor_27')},
- {peripheral.wrap('monitor_19'), peripheral.wrap('monitor_20'), peripheral.wrap('monitor_21')},
- }
- --# Create the virtual monitor (will also return the handle).
- local disp = multiMon.create('myMonitor', monitorSetup)
- --# Showcasing some basic functions.
- disp.setTextScale(0.5)
- if disp.isColour() then
- disp.setTextColour(colours.white)
- disp.setBackgroundColour(colours.black)
- end
- disp.setCursorBlink(false)
- disp.clear()
- disp.setCursorPos(1, 1)
- local width, height = disp.getSize()
- --# Some setup is needed for paint.
- parallel.waitForAny(
- function()
- --# Since paint is meant to work only on the terminal, we need to catch all touch events and turn them into mouse_click events.
- --# This happens in the background while paint is running.
- while true do
- local ev = {os.pullEvent('monitor_touch')}
- if ev[2] == 'myMonitor' then
- os.queueEvent('mouse_click', 1, ev[3], ev[4])
- end
- end
- end,
- function()
- --# Since paint uses 'term' internally, we need to set 'disp' to act as 'term'.
- term.redirect(disp)
- --# Run the program with 'image' as the argument.
- shell.run('/rom/programs/advanced/paint', 'image')
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement