🖌️ GRAPHICS#
Note
ANTIRUINS uses center coordinate for drawing.
Note
If you use .dtex files but keep a .png with the same name, the engine will load the .png version when uing the PC renderer.
Textures#
ANTIRUINS only supports pow2 sized texture from 8px to 1024px.
You can load .png files, but they takes some time to decompress, a much better alternative are .dtex file generated by pvrtex and texconv.
local TEXTURE = {
texture = id, -- texture ID used by the C engine
filename = "",
w, h = 0, 0,
palette = { -- if you use paletted texture.
index = 0,
size = 0,
colors = {}
}
}
Loads a pow2 .png or .dtex image.
Returns a texture.
Frees the texture data.
Draws a texture at x-y position.
OPTIONAL : scaleX and scaleY are floats.
OPTIONAL : angle is represented in degree.
OPTIONAL : uv is a table with 4 x 0.0 - 1.0 UV coordinates.
Sets a pixel in a texture. Uses the current drawColor.
Returns the color of a pixel in a texture.
Fonts#
The fonts are loaded as a bitmap font atlas, starting at character 32 (space). There is a Processing sketch included in the tool folder that can help you generate a font atlas. You can also find some other fonts in the default folder.
Loads a pow2 .png or .dtex image. Returns a font.
Prints text at x-y position.
If
center
is true, the text is centered.
Sets the current font size.
Palettes#
The Dreamcast has an internal palette of 1024 colors. You can take advantage of this by using paletted .dtex files. Paletted texture reduce the memory of texture to 50% (8BPP) or 25% (4BPP) compared to RGB images.
You can read more on Dreamcast texture format here.
local PALETTE = {
size = 16, --16(4BPP) or 256(8BPP) palette size
index = 0, --the location of the palette (between 1 and 1024), 0 is no palette.
colors = {}, --table of {r,g,b,a} values (between 0.0 and 1.0)
}
Returns a palette from a .dtex.pal file.
Replaces a texture palette with the provided palette.
Sets a single color in a specified palette.
The
r
argument can be a {r, g, b, a} table.
Colors#
Sets the color (0.0 - 1.0) of future textures, shapes, texts, etc.You can also use a {r, g, b, a} table.
Sets the color (0.0 - 1.0) of the background.
You can also use a {r, g, b, a} table.
Shapes#
Draws a rectangle.If
mode
is “corners”, x and y become top-left coordinates.
Draws a circle with the specified number of segments.
Draws a line from x1-y1 to x2-y2 with the specified line width.
Video#
ANTIRUINS supports ROQ video files.
Plays a video file at the specified position and size.