621 posts
Location
U.S.A.
Posted 02 April 2014 - 01:03 PM
What is the best way to get the size of a terminal, then print out a gui that fits that? Up until this point, I've done non-stretching GUIs, which I know people don't neccessarily like. *cough* Engineer *cough* Also, I know how to print a picture, but can I stretch that, or is there some other way to draw a background?
Thanks,
~Csstform
1852 posts
Location
Sweden
Posted 02 April 2014 - 01:16 PM
What kind of gui do you mean? Can you make some paint-like example of what you mean?
And the best way to get the terminal size is ofcourse
local w, h = term.getSize()
A function that I use when drawing gui etc
local function drawBox( sX, fX, sY, fY, background )
if term.isColor() then
if background then
term.setBackgroundColor( background )
end
end
local line = ""
for x = sX, fX do
line = line .. " "
end
for y = sY, fY do
term.setCursorPos( sX, y )
term.write( line )
end
end
As you probably have figured out it draws boxes, But it can be very useful when creating
GUI
Edited on 02 April 2014 - 11:17 AM
621 posts
Location
U.S.A.
Posted 02 April 2014 - 01:27 PM
What kind of gui do you mean? Can you make some paint-like example of what you mean?
And the best way to get the terminal size is ofcourse
local w, h = term.getSize()
A function that I use when drawing gui etc
local function drawBox( sX, fX, sY, fY, background )
if term.isColor() then
if background then
term.setBackgroundColor( background )
end
end
local line = ""
for x = sX, fX do
line = line .. " "
end
for y = sY, fY do
term.setCursorPos( sX, y )
term.write( line )
end
end
As you probably have figured out it draws boxes, But it can be very useful when creating
GUI
Link to a mock up of what I want:
https://github.com/GoldProgramming/GoldSuite/blob/master/tdlbak.nfp
1610 posts
Posted 02 April 2014 - 02:03 PM
What kind of gui do you mean? Can you make some paint-like example of what you mean?
And the best way to get the terminal size is ofcourse
local w, h = term.getSize()
A function that I use when drawing gui etc
local function drawBox( sX, fX, sY, fY, background )
if term.isColor() then
if background then
term.setBackgroundColor( background )
end
end
local line = ""
for x = sX, fX do
line = line .. " "
end
for y = sY, fY do
term.setCursorPos( sX, y )
term.write( line )
end
end
As you probably have figured out it draws boxes, But it can be very useful when creating
GUI
Link to a mock up of what I want:
https://github.com/GoldProgramming/GoldSuite/blob/master/tdlbak.nfp
So a function to resize a block like that to the screen?
621 posts
Location
U.S.A.
Posted 02 April 2014 - 02:11 PM
Thanks for the help, I think the folks on IRC have helped me figure this out.