Test lua rgb rainbow
All checks were successful
Build Dusk / run-tests (push) Successful in 1m15s
Build Dusk / build-linux (push) Successful in 1m23s
Build Dusk / build-psp (push) Successful in 1m26s
Build Dusk / build-dolphin (push) Successful in 2m6s

This commit is contained in:
2026-02-08 22:30:53 -06:00
parent 3db7e6b1b9
commit 592edb90a0
11 changed files with 150 additions and 14 deletions

View File

@@ -1,15 +1,12 @@
module('spritebatch')
module('camera')
module('color')
-- module('ui')
module('text')
module('screen')
module('time')
-- module('map')
module('glm')
screenSetBackground(colorBlack())
-- mapLoad('map/testmap/testmap.dmf')
camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC)
text = "Hello World"
@@ -21,11 +18,6 @@ function sceneUpdate()
end
function sceneRender()
-- Map Test
-- cameraPushMatrix(mapCamera)
-- mapRender()
-- cameraPopMatrix()
-- UI Test
cameraPushMatrix(camera)
camera.bottom = screenGetHeight()
@@ -36,7 +28,16 @@ function sceneRender()
x = math.sin(TIME.time * 2) * (x / 2) + (x / 2)
y = (screenGetHeight() - height) / 2
y = math.cos(TIME.time * 3) * (y) + (y)
textDraw(x, y, text, colorMagenta())
-- For each letter
for i = 1, #text do
letter = text:sub(i, i)
letterWidth, _ = textMeasure(letter)
-- Draw letter with rainbow color
textDraw(x, y, letter, colorRainbow((i - 1) * 0.1, 8))
x = x + letterWidth
end
cameraPopMatrix()
end