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

getting my gui to run on a monitor

Started by V497_Vesper, 25 March 2016 - 12:58 AM
V497_Vesper #1
Posted 25 March 2016 - 01:58 AM
I have built a GUI as an experiment called
Base Welcome, and the idea behind it is this, when you enter the base you will be in the lobby looking at a monitor and on this monitor is a rough base map (drawn using paint) and what i want the program to do is this

as it starts up the program opens up on the monitor and the player sees the map so how do i get the program on the monitor at startup?
Bomb Bloke #2
Posted 25 March 2016 - 02:40 AM
Stick a file on the computer called "startup". In it put something like:

shell.run("monitor <monitorSide> <programToRunOnMonitor>")

Or just redirect term to the wrapped monitor, load your image and draw it.
V497_Vesper #3
Posted 25 March 2016 - 03:03 AM
thank you That works but now i got a new issue; when the program loads onto the monitor i get this


as you can see there are 2 white lines on the left and on the bottom, how do i get rid of these?
when i painted the image on paint i filled all sides of the canvas so why does it look like this and how can i resolve it?


--Desktop
slc = 0
tBarC = 8
tBartC = 1
backColour= 1
term.setBackgroundColor(backColour)
term.clear()
term.setCursorPos(1, 2)

function drawDesktop()
bground = paintutils.loadImage(".BaseImage")
paintutils.drawImage(bground,1,1)
term.setCursorPos(1,1)
end
drawDesktop()

here is the pastebin
http://pastebin.com/r4TccpHx

and like you suggested the coding above is the program I have modified it is called BWelcome and the code is


shell.run("monitor left Bwelcome")
Edited on 25 March 2016 - 02:14 AM
Bomb Bloke #4
Posted 25 March 2016 - 03:20 AM
The canvas paint shows you has to have the colour selector and lower options menu alongside it, so it can never be the same size as the display you're working on.

Just draw the image at 2,2 instead of 1,1. If you don't like the colour of the resulting border, set your desired colour as background and call term.clear() before drawing the image.
V497_Vesper #5
Posted 25 March 2016 - 11:28 PM
using what i have learned here i'd like to utilise this in an interesting way like programming an overlay that the player can click on to switch to different backgrounds like for example have a button to the top left of the screen that switches to another screen with the image of the Silos and an indicator stating open or closed
is that possible?