|
local function | clear (color) |
| std.draw.clear
|
|
local function | rect (mode, pos_x, pos_y, width, height) |
| std.draw.rect
|
|
local function | line (x1, y1, y2, y1, y2) |
| std.draw.line
|
|
local function | poly (mode, verts, pos_x, pos_y, scale, angle, origin_x, origin_y) |
| std.draw.poly
|
|
- Design Decision
There is no std.draw.pixel or std.draw.circle, nor plans to add them, due to frontend design decisions. The engine is designed to be multiplatform, ensuring code runs on all devices while respecting their processing and memory limits.
std.draw.pixel
there are no optimizations to be done in many cases it would just be a std.draw.rect(x, y, 1, 1), so leave this as a user task.
std.draw.circle
The ginga does not have the ability to draw circles on most televisions devices,
and older video games like gba and nds are very expensive to resize them every frame.
- Tool IMG Gen
It is possible to create logos or any images using the engine's real-time drawing API while writing the rendering code and clicking download.
◆ clear()
local function clear |
( |
color | | ) |
|
◆ line()
local function line |
( |
x1 | , |
|
|
y1 | , |
|
|
y2 | , |
|
|
y1 | , |
|
|
y2 | ) |
◆ poly()
local function poly |
( |
mode | , |
|
|
verts | , |
|
|
pos_x | , |
|
|
pos_y | , |
|
|
scale | , |
|
|
angle | , |
|
|
origin_x | , |
|
|
origin_y | ) |
- Example
local spaceship = {-2,3, 0,-2, 2,3}
std.draw.poly(0, spaceship, game.player_x, game.player_y, 1, player_angle)
- Parameters
-
mode |
- 0 fill-closed
- 1 frame-closed
- 2 frame-opened
|
verts | array of x and y |
pos_x | (optional) |
pos_y | (optional) |
scale | (optional) |
angle | (optional) |
origin_x | (optional) |
origin_y | (optional) |
◆ rect()
local function rect |
( |
mode | , |
|
|
pos_x | , |
|
|
pos_y | , |
|
|
width | , |
|
|
height | ) |