Posted 06 March 2016 - 02:19 PM
Hello, and welcome, if you clicked here, it's probably because you want to see why my API is so boring.
Well, because it's not a normal API.
Well, not with my API.
SlimeGUI is not doing nothing directly to the screen. It's just changing a table. Like :
And that is not printing any pixel.
No, you just have to use SlimeGUI.apply() to change the table into a beautiful screen with pixels !
Well… a bit, but for good reasons !
First, you can know the color of a pixel.
Knowing that, you can do a screenshot system, and it's what I did !
Or even do text with real no background !
pixel color will not be replaced !
With a normal API, the background color of the text would replace the pixels :
(Pixels are actually printed behind)
But you can still use functions like circle() and all of that
(btw i'm using Bresenham circle and ellipse algorithm, but you can still use the sqrtCircle() function)
Yes.
It's just not compatible yet with Monitors and Pocket Computers.
So, little documentation :
int
string
boolean
optional
Functions :
SlimeGUI.init(backgroundColor)
Will create the table and put a background color.
(Use that after loading the API !)
SlimeGUI.apply()
Will turn the table into text and pixels.
SlimeGUI.line(startX, startY, endX, endY, color)
Similar to paintutils.line(), will create a line using Bresenham's algorithm.
SlimeGUI.rectangle(x, y, width, height, color, filled)
Will draw a rectangle.
SlimeGUI.validPixel(x, y)
returns true if the pixel is in the table, false if it's not.
SlimeGUI.textPrint(text, x, y, textColor, backgroundColor).
Will put a text.
SlimeGUI.sqrtCircle(x, y, radius, color, filled)
Avoid this one. Doing sqrt algorithm to draw a circle.
SlimeGUI.circle(x, y, radius, color)
This one can't be filled yet, but using Bresenham's algorithm that is better than the sqrt one.
SlimeGUI.ellipse(x, y, width, height, color)
This one can't be filled yet, using Bresenham's algorithm.
SlimeGUI.pixel(x, y, color)
Change the color of a pixel.
SlimeGUI.screenshot(filename)
Will save a screenshot
SlimeGUI.loadScreenshot(filename)
Will load a screenshot
SlimeGUI.triangle(x1, y1, x2, y2, x3, y3, color)
This one can't be filled yet, Doing a triangle.
Table variables :
SlimeGUI.t[x][y].color
Change the color of the pixel. (error if pixel is out of the screen, please use pixel() function if you can)
SlimeGUI.t[x][y].text
Character of the pixel, only ONE character.
SlimeGUI.t[x][y].textColor
Color of the character.
SlimeGUI.t[x][y].isText
Says if the pixel contains a character.
Then, example code : http://pastebin.com/vpgKgAc8
And finally, SlimeGUI : pastebin get 2NR1C52B SlimeGUI
Well, because it's not a normal API.
What ? Everybody says that, a graphical API is a graphical API, you just call a thingy and the shape is here woo yeah…
Well, not with my API.
SlimeGUI is not doing nothing directly to the screen. It's just changing a table. Like :
SlimeGUI.t[5][8].color = "blue"
And that is not printing any pixel.
Ok, that's useless ?
No, you just have to use SlimeGUI.apply() to change the table into a beautiful screen with pixels !
It's still useless, why doing that when you can directly print pixels on a screen ? You are complicating things !
Well… a bit, but for good reasons !
First, you can know the color of a pixel.
print(SlimeGUI.t[5][8].color)
> red
Knowing that, you can do a screenshot system, and it's what I did !
SlimeGUI.screenshot("myScreenshot") -- Saving screenshot in the "myScreenshot" file
SlimeGUI.loadScreenshot("myScreenshot") -- Loading the screenshot into the table
SlimeGUI.apply() -- Print the screenshot
Or even do text with real no background !
pixel color will not be replaced !
With a normal API, the background color of the text would replace the pixels :
(Pixels are actually printed behind)
But you can still use functions like circle() and all of that
(btw i'm using Bresenham circle and ellipse algorithm, but you can still use the sqrtCircle() function)
Ok, so "Mister" made an API that just added that and he is happy enough to put that on cc forums ?
Yes.
Oh, ok.
It's just not compatible yet with Monitors and Pocket Computers.
So, little documentation :
Spoiler
Note : SlimeGUI uses color in STRING format ! ("blue" not colors.blue)int
string
boolean
optional
Functions :
SlimeGUI.init(backgroundColor)
Will create the table and put a background color.
(Use that after loading the API !)
SlimeGUI.apply()
Will turn the table into text and pixels.
SlimeGUI.line(startX, startY, endX, endY, color)
Similar to paintutils.line(), will create a line using Bresenham's algorithm.
SlimeGUI.rectangle(x, y, width, height, color, filled)
Will draw a rectangle.
SlimeGUI.validPixel(x, y)
returns true if the pixel is in the table, false if it's not.
SlimeGUI.textPrint(text, x, y, textColor, backgroundColor).
Will put a text.
SlimeGUI.sqrtCircle(x, y, radius, color, filled)
Avoid this one. Doing sqrt algorithm to draw a circle.
SlimeGUI.circle(x, y, radius, color)
This one can't be filled yet, but using Bresenham's algorithm that is better than the sqrt one.
SlimeGUI.ellipse(x, y, width, height, color)
This one can't be filled yet, using Bresenham's algorithm.
SlimeGUI.pixel(x, y, color)
Change the color of a pixel.
SlimeGUI.screenshot(filename)
Will save a screenshot
SlimeGUI.loadScreenshot(filename)
Will load a screenshot
SlimeGUI.triangle(x1, y1, x2, y2, x3, y3, color)
This one can't be filled yet, Doing a triangle.
Table variables :
SlimeGUI.t[x][y].color
Change the color of the pixel. (error if pixel is out of the screen, please use pixel() function if you can)
SlimeGUI.t[x][y].text
Character of the pixel, only ONE character.
SlimeGUI.t[x][y].textColor
Color of the character.
SlimeGUI.t[x][y].isText
Says if the pixel contains a character.
Then, example code : http://pastebin.com/vpgKgAc8
And finally, SlimeGUI : pastebin get 2NR1C52B SlimeGUI