(Admins, if this post gets deleted, please tell me why in PM.)

Hello everyone,

Meet Graphics, a GUI API which right now lets you draw buttons, labels, checkboxes and background images! (and more stuff in the future!)

I will also use Graphics in my upcoming OS (will probably be named DoorOS).

P. S. If you use this API, plz let me know in the replies, means a lot to me!

API download (contact me if Pastebin takes it down):
Spoilerpastebin get VULySNcv graphics

Button documentation:
Spoiler
btn1 = graphics.button:new()
Creates a new button named btn1.

Buttons come with the following values:
bkgColor - defines the background color of the button. Default value: colors.blue.
tColor - defines the color of the text. Default value: colors.white.
text - defines the text to be printed on the button. Default value: "Text".
w - defines the width of the button. Default value: 6.
h - defines the height of the button. Default value: 3.
textx - defines where the text will be on the X axis relatively to the button's X axis. Default value: 1.
texty - defines where the text will be on the Y axis relatively to the button's Y axis. Default value: 1.
x - defines where the button will be on the X axis. Default value: 2.
y - defines where the button will be on the Y axis. Default value: 2.
trigger - defines the function that will run when the button is triggered. (If you want to handle that yourself with your own code, no worries, you can do that. The detect function will return true if the button is clicked.) Default value: function()
print("Default trigger function. :)/>")
end

Now with all the values covered, let's go to the 2 functions!

btn1:draw() draws the button just as its name says.

btn1:detect(x, y, trig) takes the received X and Y values and uses them to find out if the button is clicked or not, then if it is, if trig is set to true, it will trigger the button, thus running the trigger function mentioned before. Most useful when paired with the mouse_click event.

That's about it so far. Will work on adding more functions (primarily drawCentered and drawCornered!)

Label documentation:
SpoilerTo create a new label (we will call it label1 for now), use this line o' code:

label1 = graphics.label:new()

Just like buttons, labels have a few values to make use of:
bkgColor - defines the background color of the label. Default value: colors.black.
tColor - defines the text color of the label. Default value: colors.white.
text - self-explanatory, bro!
x - defines the X axis of the label. Default value: 2.
y - defines the Y axis of the label. Default value: 2,

Labels, unlike buttons, don't have detect() (might add it if you people wish for it, tho), they do have 2 other functions,

label1:drawCentered() - ditches the X value and draws the label in the horizontal center and in the Y axis given to the label itself.

and label1:drawCornered(horcorner, vercorner) - ditches both X and Y values and draws the label in the specified corner. horcorner can be "left" or "right", while vercorner can be "top" or "bottom".

Checkbox documentation:
Spoiler
check1 = graphics.checkbox:new()
will create a new checkbox called check1.

Checkboxes have these values:
text - self-explanatory, bro!
x - the X axis of the cbox (will call them that from now on). Default value: 2.
y - the Y axis of the cbox. Default value: 2.
checked - tells whether the cbox is checked or not. Default value: false. Can be safely changed to true before drawing the cbox.
w, h - don't even bother with these values. The code does it as needed.

Checkboxes also have some functions:
check1:draw() - Do I seriously need to say what this one does?!
check1:detect(x, y) - Same detect function the buttons have, except this one returns NOTHING and just changes the state of the cbox.

Background image documentation:
Spoiler
background = graphics.backgroundimg:new()
creates a new background image named background.

They have only one value:
path - the path of the image. Must be absolute. Hint: Use shell.resolve(relativePath) to convert a relative path to an absolute one. Might look into adding an automatic relative-to-absolute path converter soon. :D/>

And they also have only one function:
background:draw() - draws the image. Be careful, because if the path is relative and/or the file doesn't exist, an error will be thrown! Will work on writing code that will prevent this before it causes an error, tho.

Changelog:
Spoilerv1.0 - initial release, had only buttons! :P/>

v1.1 - feature update, adds labels, checkboxes and background images on top of buttons

Also yeah, IK Graphics will NEVER stand a chance against Titanium. Still wanted to show it tho.