55 lines
1.0 KiB
Lua
55 lines
1.0 KiB
Lua
name = "DVD"
|
|
authors = {"AviiNL"}
|
|
description = "Bouncing 'dvd' Logo"
|
|
|
|
local width = g13.display_width
|
|
local height = g13.display_height
|
|
|
|
local x = 22.0
|
|
local y = 6.0
|
|
|
|
local x_direction = 1
|
|
local y_direction = 1
|
|
|
|
local speed = 20
|
|
|
|
local size = 3
|
|
|
|
function setup()
|
|
joy.deadzone = 40
|
|
end
|
|
|
|
function update(delta: number)
|
|
x = x + speed * delta * joy.x * 1.2
|
|
y = y + speed * delta * joy.y
|
|
|
|
local color_x = (x / width) * 255
|
|
local color_y = (y / height) * 255
|
|
local color_z = 255 - (color_x + color_y) / 2
|
|
|
|
g13.clear()
|
|
|
|
g13.set_color(color_x/2, color_y/2, color_z/2)
|
|
|
|
g13.text("Hello World!", 1, 1, true, 0, 0, 1)
|
|
|
|
for sy = -size,size do
|
|
for sx = -size,size do
|
|
g13.set_pixel(x + sx, y + sy, true)
|
|
end
|
|
end
|
|
end
|
|
|
|
function dump(o)
|
|
if type(o) == 'table' then
|
|
local s = '{ '
|
|
for k,v in pairs(o) do
|
|
if type(k) ~= 'number' then k = '"'..k..'"' end
|
|
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
|
end
|
|
return s .. '} '
|
|
else
|
|
return tostring(o)
|
|
end
|
|
end
|