sumary

tico module

tico.getVersion()

graphics module

tico.graphics.getSize()

Returns the current window size

local w, h = tico.graphics.getSize()

tico.graphics.clear(r, g, b, a)

tico.graphics.clear(color)

Clear the current framebuffer

If none argument is passed, clear to black

function tico.draw()
	tico.graphics.clear(255, 0, 0)
end
Color = require "tico.color"

function tico.draw()
	tico.graphics.clear(Color.Red)
end
function tico.draw()
	tico.graphics.clear({255, 0, 0})
end

tico.graphics.newCanvas(width, height)

Create a new canvas (OpenGL framebuffer)

Canvas functions:

:draw(x, y, angle, scaleX, scaleY, centerX, centerY, color)

:draw(x, y, color)

Draw the canvas

All arguments are optional

:auto()

Draw canvas and auto scale to fit window size but maintain the ratio

:getWidth()

Get the canvas texture width

:getHeight()

Get the canvas texture height

:getSize()

Get the canvas texture size

:attach()

Attach the Canvas

:detach()

Detach the Canvas, backing to the default framebuffer

function tico.load()
	canvas = tico.graphics.newCanvas(320, 240)
end

function tico.draw()
	canvas:attach()
	tico.graphics.clear()
	tico.graphics.drawRectangle(0, 0, 32, 32)
	canvas:detach()

	canvas:auto()
end

tico.graphics.newImage(filename)

Creates a new image

Image functions

:draw(x, y, angle, scaleX, scaleY, centerX, centerY, color)

Draw the image

All arguments are optional

:getWidth()

Get the image’s width

:getHeight()

Get the image’s height

:getSize()

Get the image’s size

function tico.load()
	image = tico.graphics.newImage("image.png")
end

function tico.draw()
	image:draw(32, 32)
end

tico.graphics.newRectangle(x, y, w, h)

Creates a new Rectangle

Rectangle functions

:width()

Get the rectangle width

:height()

Get the rectangle height

:x()

Get the rectangle x

:y()

Get the rectangle y

tico.graphics.drawRectangle(x, y, w, h, color)

Draw a lined rectangle

tico.graphics.fillRectangle(x, y, w, h, color)

Draw a filled rectangle

tico.graphics.drawCircle(x, y, radius, color)

Draw a lined circle

tico.graphics.fillCircle(x, y, radius, color)

Draw a filled circle

tico.graphics.drawTriangle(x0, y0, x1, y1, x2, y2, color)

Draw a lined triangle

tico.graphics.fillTriangle(x0, y0, x1, y1, x2, y2, color)

Draw a lined triangle

tico.graphics.line(x0, y0, x1, y1, color)

Draw a line

-args: - x0, x1: number - y0, y1: number - color: table ({255, 255, 255})

tico.graphics.scissor(x, y, w, h)

Set a scissor

tico.graphics.print(text, x, y, color)

tico.graphics.print(Font, text, x, y, color)

Draw text on the screen

tico.graphics.printf(text, x, y, sx, sy, color)

tico.graphics.printf(Font, text, x, y, sx, sy, color)

extended tico.graphics.print