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

help a newbe with command window.create

Started by GalactusX, 09 September 2015 - 05:51 PM
GalactusX #1
Posted 09 September 2015 - 07:51 PM
Hello everyone, I came back to play minecraft after a long period of inactivity (work, social life …), and I was very glad to see this new "window.create" I've been looking all forums, but I have not found enough information on how to use it; I would greatly appreciate if you could extend me the information in the wiki with some small example and how to use it, I'm planning to do a program for users of the server on which I am a member of staff

I've been watching and reviewing many lines of program code from other people, but it is not clear to me.

thanks a lot to all people contribute

(sorry for my bad english, i´m spanish)
Edited on 09 September 2015 - 05:58 PM
KingofGamesYami #2
Posted 09 September 2015 - 07:56 PM

local maxx, maxy = term.getSize()
local win = window.create( term.current(), 1, 1, maxx / 2, maxy / 2 )
win.setBackgroundColor( colors.blue )
win.clear()
sleep( 1 )
term.setBackgroundColor( colors.black )
term.clear()
sleep( 1 )
win.redraw()

Windows can use all of the term functions, as well as the additional functions in bold.

Window API
GalactusX #3
Posted 09 September 2015 - 08:03 PM

local maxx, maxy = term.getSize()
local win = window.create( term.current(), 1, 1, maxx / 2, maxy / 2 )
win.setBackgroundColor( colors.blue )
win.clear()
sleep( 1 )
term.setBackgroundColor( colors.black )
term.clear()
sleep( 1 )
win.redraw()

Windows can use all of the term functions, as well as the additional functions in bold.

Window API

first, thanks for the fast answer, and second, another question, can i define the dimensions of the window? i mean set a default height-long for the window? (i forget you can define it, sory)

another question.. how you can turn on / off that window? i mean draw it and hide
Edited on 09 September 2015 - 06:14 PM
KingofGamesYami #4
Posted 09 September 2015 - 08:22 PM
In my example, I used win.redraw to draw the window. To hide the window, draw something over it.

To prevent further calls to the window from showing, you can use win.setVisible.
Edited on 09 September 2015 - 06:23 PM
GalactusX #5
Posted 09 September 2015 - 08:26 PM
Thanks KingofGamesYami, now time to play w code, i come back when i programe some code