Posted 29 March 2013 - 12:14 PM
Hello,
I am currently making a program that will run on a touchscreen monitor and will display some useful information. I use a simple function that centers the text on the monitor. The issue is that whenever I reboot the computer the text (and size of monitor thanks to mon.getSize()) is wrong. my monitor says that it is 29 by 19, but after terminating the program and running it again the monitor and the text go back to the correct 14 by 10.. Not quite sure what the issue is but Ill post the snippets of code that pertian to the monitor printing. Thanks for any and all help!
I am currently making a program that will run on a touchscreen monitor and will display some useful information. I use a simple function that centers the text on the monitor. The issue is that whenever I reboot the computer the text (and size of monitor thanks to mon.getSize()) is wrong. my monitor says that it is 29 by 19, but after terminating the program and running it again the monitor and the text go back to the correct 14 by 10.. Not quite sure what the issue is but Ill post the snippets of code that pertian to the monitor printing. Thanks for any and all help!
mon = peripheral.wrap("left") --setting up the variable
local w,h = mon.getSize()
function printCentered(str, ypos)
mon.setCursorPos(w/2 - #str/2, ypos)
mon.write(str)
end
--useful little function, youre welcome to it if you would like.
print("Width: "..w.." Height: "..h)
--and the basic debug script to show me that it says the wrong size the first time the program runs but fixes itself