Jump to content




GUI Help


  • You cannot reply to this topic
4 replies to this topic

#1 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 02 April 2014 - 12: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

#2 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 02 April 2014 - 12: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 by Hellkid98, 02 April 2014 - 12:17 PM.


#3 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 02 April 2014 - 12:27 PM

View PostHellkid98, on 02 April 2014 - 12:16 PM, said:

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/G...ster/tdlbak.nfp

#4 apemanzilla

  • Members
  • 1,421 posts

Posted 02 April 2014 - 01:03 PM

View PostCsstform, on 02 April 2014 - 12:27 PM, said:

View PostHellkid98, on 02 April 2014 - 12:16 PM, said:

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/G...ster/tdlbak.nfp
So a function to resize a block like that to the screen?

#5 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 02 April 2014 - 01:11 PM

Thanks for the help, I think the folks on IRC have helped me figure this out.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users