Difference between revisions of "Window (API)"
(Created window API page.) |
MKlegoman357 (Talk | contribs) m (Recreated table using {{API table}} tag) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{lowercase}} |
+ | Added by ComputerCraft 1.6, the '''Window API''' allows easy definition of spaces within the display that can be written / drawn to, then later [[window.redraw|redrawn]] / [[window.reposition|repositioned]] / etc as need be. The API itself contains only one function, [[window.create|window.create()]], which returns the windows themselves. | ||
+ | |||
+ | Windows are considered terminal objects - as such, they have access to nearly all the commands in the [[Term (API)|term API]] (plus a few extras of their own, listed within said API) and are valid targets to [[term.redirect|redirect to]]. | ||
+ | |||
+ | Each window has a "parent" terminal object, which can be the computer's own display, a [[monitor]], another window or even other, user-defined terminal objects. Whenever a window is rendered to, the actual screen-writing is performed via that parent (or, if that has one too, then ''that'' parent, and so forth). Bear in mind that the cursor of a window's parent will hence be moved around etc when writing a given child window. | ||
+ | |||
+ | Windows retain a memory of everything rendered "through" them (hence acting as display buffers), and if the parent's display is wiped, the window's content can be easily [[window.redraw|redrawn]] later. A window may also be flagged as [[window.setVisible|invisible]], preventing any changes to it from being rendered until it's flagged as visible once more. | ||
+ | |||
+ | A parent terminal object may have multiple children assigned to it, and windows may overlap. For example, the [[Multishell]] system functions by assigning each tab a window covering the screen, each using the starting terminal display as its parent, and only one of which is visible at a time. | ||
+ | |||
+ | ==API== | ||
+ | |||
+ | {{API table|window|image=Grid disk.png|2= | ||
+ | |||
+ | {{API table/row | ||
+ | |[[window.create]]({{type|table}} parentTerm, {{type|number}} x, {{type|number}} y, {{type|number}} width, {{type|number}} height [<nowiki/>, {{type|boolean}} visible]) | ||
+ | |{{type|table}} windowObject | ||
+ | |Creates and returns a new window object, similar to a [[peripheral.wrap|wrapped]] [[monitor]]. Refer to the [[term (API)|term API]] for a list of functions attached to it. | ||
+ | |odd}} | ||
+ | |||
+ | }} | ||
+ | |||
+ | [[Category:APIs]] |
Latest revision as of 19:21, 9 April 2014
Added by ComputerCraft 1.6, the Window API allows easy definition of spaces within the display that can be written / drawn to, then later redrawn / repositioned / etc as need be. The API itself contains only one function, window.create(), which returns the windows themselves.
Windows are considered terminal objects - as such, they have access to nearly all the commands in the term API (plus a few extras of their own, listed within said API) and are valid targets to redirect to.
Each window has a "parent" terminal object, which can be the computer's own display, a monitor, another window or even other, user-defined terminal objects. Whenever a window is rendered to, the actual screen-writing is performed via that parent (or, if that has one too, then that parent, and so forth). Bear in mind that the cursor of a window's parent will hence be moved around etc when writing a given child window.
Windows retain a memory of everything rendered "through" them (hence acting as display buffers), and if the parent's display is wiped, the window's content can be easily redrawn later. A window may also be flagged as invisible, preventing any changes to it from being rendered until it's flagged as visible once more.
A parent terminal object may have multiple children assigned to it, and windows may overlap. For example, the Multishell system functions by assigning each tab a window covering the screen, each using the starting terminal display as its parent, and only one of which is visible at a time.
API
window (API) | ||
---|---|---|
Function | Return values | Description |
window.create(table parentTerm, number x, number y, number width, number height [, boolean visible]) | table windowObject | Creates and returns a new window object, similar to a wrapped monitor. Refer to the term API for a list of functions attached to it. |