input and text and stuff
This commit is contained in:
@@ -15,27 +15,23 @@ local speed = 20
|
||||
|
||||
local size = 3
|
||||
|
||||
function setup()
|
||||
joy.deadzone = 40
|
||||
end
|
||||
|
||||
function update(delta: number)
|
||||
x = x + speed * delta * x_direction
|
||||
y = y + speed * delta * y_direction
|
||||
|
||||
if x <= size or x >= width - size then
|
||||
x_direction = -x_direction
|
||||
end
|
||||
|
||||
if y <= size or y >= height - size then
|
||||
y_direction = -y_direction
|
||||
end
|
||||
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.set_color(color_x/2, color_y/2, color_z/2)
|
||||
|
||||
g13.clear()
|
||||
|
||||
print(x, y)
|
||||
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
|
||||
@@ -43,3 +39,16 @@ function update(delta: number)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user