Posted 14 October 2012 - 07:41 PM
Today I made a little program, which converts a PNG, JPEG, BMP etc. image file into a format, that my API can read, and construct an image from. This image can then be displayed on advanced computers.
These are the functions and variables, that this API let's you use with:
This is how to use it:
NOTE: LÖVE MUST BE INSTALLED!
Example of how to use it:
Screenshots:
NOTE: The white line is caused by me typing, and is NOT an error in the API.
NOTE: The color LIGHT GREY is NOT supported.
NOTE: This might be very buggy. I have not have time to test this alot, but I hope for the best.
Download(Includes API and converter)
These are the functions and variables, that this API let's you use with:
image.createQuad(x, y, w, h) -- returns a new quad_class
quad_class.x -- number
quad_class.y -- number
quad_class.width -- number
quad_class.height -- number
image.createImage(path) -- returns an image_class
image_class:draw() -- draws the image
image_class:drawq(q) -- draws the image with a quad(google it)
image_class:getWidth() -- returns the width of the image
image_class:getHeight() -- returns the height of the image
image_class.x -- number
image_class.y -- number
This is how to use it:
Spoiler
Windows:- Convert an image into a .ccimg file: In the console, type this in:
love2d\love.exe CCImg <path/to/file> <save/to/path>
- Move the file to anywhere you want, as long as it can be acccessed by the computer.
- Load it through the API.
- Draw!
NOTE: LÖVE MUST BE INSTALLED!
- Convert an image into a .ccimg file: In the terminal, type this:
love CCImg/ <path/to/file> <save/to/path>
- Move the file to anywhere you want, as long as it can be acccessed by the computer.
- Load it through the API.
- Draw!
Example of how to use it:
os.loadAPI(shell.resolve("image"))
term.setBackgroundColor(colours.pink)
term.clear()
local img = image.createImage("data/x.ccimg")
img.x = 3
img:draw()
read("")
term.setBackgroundColor(colours.black)
term.clear()
term.setCursorPos(1, 1)
Screenshots:
Spoiler
NOTE: The white line is caused by me typing, and is NOT an error in the API.
NOTE: The color LIGHT GREY is NOT supported.
NOTE: This might be very buggy. I have not have time to test this alot, but I hope for the best.
Download(Includes API and converter)