API to make pretty GUIs in Computercraft for Minecraft
###Features:
- Full error handling, clearly tells you what you did wrong
- Buttons
- Shapes (rectangles & lines)
- Ablilty to create clickable reagons of the screen that aren't drawn as buttons and similarly to create boxes with text that look like buttons, but don't trigger anything
- Customizable text color & background color
- Cool example programs
###Functions:
gui.button.add(text, function, x, y, spacing, height, textcolor, backgroundcolor)
- Draws a button on the screen, returns ID which can be used for certain operationsgui.button.draw(text, x, y, spacing, height, textcolor, backgroundcolor)
- One of the two functions that gui.button.add uses, draws what appears to be a button, but dosen't do or return anythinggui.button.index(function, x1, y1, x2, y2, isdrawn [,tcolor, bcolor, text])
- Creates a clickable region which acts like a button, is the second function used by gui.button.add. If you're creating just a clickable region then the 'isdrawn' argument should be false and the last 3 should be excludedgui.button.gray(ID)
- Either grays out or ungrays a button rendering it unclickable, if you are just disabling a clickable region, gui.button.gray will not attempt to draw a gray button, but instead just disable it.gui.shape.rect(x, y, width, height, color)
- Draws a rectangle, but relies on gui.shape.altrect.gui.shape.altrect(x1, y1, x2, y2, color)
- Also draws a rectangle, but using coord1 and coord2 rather than coord and width.gui.shape.line(x1,y1,x2,y2,color)
- Basic line algoritmgui.fill(x, y, color [, char])
- Fills a single pixel with the specified color or charecter using the preset textcolor.gui.progbar.add(x, y, width, percent, forecolor, backcolor)
- Craetes a progress bar already at the specified percent (or 0), returns ID for use with next 2 functionsgui.progbar.increment(ID, percent)
- Increments the percent of the progress bar with ID given by percent, returns total percent.gui.progbar.set(ID, percent)
- Sets percent of progress bar with ID given to percent.
####Control Methods
-
start()
- Simple enough, engages in an infinite loop which checks if a button is clicked and runs the apropriate user-defined function -
stop()
- Stops the click checking method Hint: becausestart()
is an infinite loop, to usestop()
, the routine that does it must be run using the parallel API, this is covered in detail in the 2.0 release notesMore to come...