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

Simple Button API

Started by valithor, 17 December 2014 - 06:08 AM
valithor #1
Posted 17 December 2014 - 07:08 AM
While procrastinating for studying for finals I decided to write a very simple button api.

The code can be found at http://pastebin.com/Jv5tRa9x

A very basic example can be found at http://pastebin.com/EXURN49Q

I will probably add a little more to this when I get a chance, but right now it consists of two basic functions.

cButton: input the minX, maxX, minY, and maxY, and it returns a table. This function really doesnt do much, but is just there to make the next function easier to use.

check: input the table of buttons, and the clicked x and y coord. It returns the number of the button clicked based upon the order they are in the table passed to the function.


When I get a chance sometime tomorrow I will probably do a few things I already have in mind for this, but at the time I posted this it is 1 AM (sorry if it is hard to read/understand). Will add screenshots/more examples when I make those changes.
ByteMe #2
Posted 17 December 2014 - 08:01 AM
can the table be moved around?