This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Termanater13's profile picture

converting code to work with a computer thats written for a monitor

Started by Termanater13, 04 March 2014 - 05:01 PM
Termanater13 #1
Posted 04 March 2014 - 06:01 PM
I am looking to add support for my button api to allow the use of the computer screen and not just the monitor. I know I am going to need the term api to do this, and text scale will not work, is there anything else I need to take into consideration when doing this?

please note that I am not asking for someone to do it for me, but if you want to look at the code follow the links below
forum post http://www.computercraft.info/forums2/index.php?/topic/17346-button-api/
pastebin http://pastebin.com/FPC8tYXe
Lignum #2
Posted 04 March 2014 - 06:07 PM
Besides from text scale you don't need to worry about anything.

To make life easier, you can store the API to use in a variable.
Like this:

local surface = term
if use a monitor then
    surface = peripheral.wrap(monitor side)
end
surface.setCursorPos(5, 5)
surface.write(" ")
. . .
CometWolf #3
Posted 04 March 2014 - 06:13 PM
You'll need to pull mouse_click events instead of monitor_touch aswell, but that should be it really. Essentially you could just throw in mon = term at the top of your code, and work around the textScale, change the pullEvent, and you should be good to go.