Mercurial > games > semicongine
diff examples/E02_squares.nim @ 203:84fd522fdf3f
did: update examples to use new API for scene + scene globals
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 08 May 2023 21:21:49 +0700 |
parents | 25d97fa0ad5c |
children | 6e2017cb8b8b |
line wrap: on
line diff
--- a/examples/E02_squares.nim Mon May 08 00:48:11 2023 +0700 +++ b/examples/E02_squares.nim Mon May 08 21:21:49 2023 +0700 @@ -84,12 +84,11 @@ var myengine = initEngine("Squares") myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) - var scene = newEntity("scene", newEntity("squares", squaremesh)) + var scene = newScene("scene", newEntity("scene", newEntity("squares", squaremesh))) myengine.addScene(scene, vertexInput) - var time = initShaderGlobal("time", 0.0'f32) - scene.components.add time + scene.addShaderGlobal("time", 0.0'f32) while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): - setValue[float32](time.value, get[float32](time.value) + 0.0005) + setShaderGlobal(scene, "time", getShaderGlobal[float32](scene, "time") + 0.0005'f) myengine.renderScene(scene) myengine.destroy()