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

How do I make this fill the screen?

Started by gun and run, 27 January 2013 - 08:59 AM
gun and run #1
Posted 27 January 2013 - 09:59 AM
This program displays your terminal to a monitor and allows you to still use the terminal. The problem is that it does not fill the monitor completely, it fills about a 3*5 screen, when I would like it to fill a 6*8 screen.
I'm new to this, please help.


--[[
  demo
  by BigSHinyToys
]]--
local sides = {
  [1] = "left",
  [2] = "top",
  [3] = "bottom",
  [4] = "right",
  [5] = "back",
  [6] = "front",
  }
local tArgs = {...}
local monSide
local monBig = false
local termX,termY = term.getSize()
local customTerm = {}
local moniter
local oldMon = {}
local attached = false
for i=1,6 do
if peripheral.getType(sides[i]) == "monitor" then
  monSide = string.lower(sides[i])
  if peripheral.isPresent(monSide) and peripheral.getType(monSide) == "monitor" then
   attached = true
   local monX,monY = peripheral.call(monSide,"getSize")
   if monX >= termX and monY >= termY then
	monBig = true
   else
	peripheral.call(monSide,"setTextScale",0.5)
	monX,monY = peripheral.call(monSide,"getSize")
	if monX >= termX and monY >= termY then
		 monBig = true
	else
		 print("Monitor to small")
	end
   end
  end
elseif #tArgs == 1 then
  if string.lower(tArgs[1]) == "restore" then
   term.restore()
  end
end
end
if not attached then
  print("No screen attatched")
end
local function wrap( _sFunction )
return function( ... )
  if peripheral.isPresent(monSide) then
   peripheral.call(monSide,_sFunction,...)
   return oldMon[_sFunction](...)
  else
   term.restore()
   print("Screen restored")
  end
end
end
if monBig then
moniter = peripheral.wrap(monSide)
for k,v in pairs(term.native) do
  oldMon[k] = v
end
for k,v in pairs( term.native ) do
  if type( k ) == "string" and type( v ) == "function" then
   customTerm[k] = wrap(k)
  end
end
term.redirect(customTerm)
term.clear()
term.setCursorPos(1,1)
print("Running on monitor")
end
Lyqyd #2
Posted 27 January 2013 - 10:04 AM
Split to new topic.
remiX #3
Posted 27 January 2013 - 10:05 AM
What is it that you need help with?
gun and run #4
Posted 27 January 2013 - 10:19 AM
This program will only split my terminal display to my monitor filling half the screen. I would like to modify it to fit the screen its projected to.