Mercurial > games > semicongine
comparison examples/E02_squares.nim @ 763:a4c757f5d17f
did: change API for ECS
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 27 Jun 2023 00:17:40 +0700 |
parents | 5cd6808150fc |
children | 754835bf175e |
comparison
equal
deleted
inserted
replaced
762:4f991bc3613a | 763:a4c757f5d17f |
---|---|
79 setMeshData[uint32](squaremesh, "index", iValues.toSeq) | 79 setMeshData[uint32](squaremesh, "index", iValues.toSeq) |
80 | 80 |
81 var myengine = initEngine("Squares") | 81 var myengine = initEngine("Squares") |
82 myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) | 82 myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) |
83 | 83 |
84 var scene = newScene("scene", newEntity("scene", newEntity("squares", squaremesh))) | 84 var scene = newScene("scene", newEntity("scene", [], newEntity("squares", {"mesh": Component(squaremesh)}))) |
85 myengine.addScene(scene, vertexInput, @[], transformAttribute="") | 85 myengine.addScene(scene, vertexInput, @[], transformAttribute="") |
86 scene.addShaderGlobal("time", 0.0'f32) | 86 scene.addShaderGlobal("time", 0.0'f32) |
87 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): | 87 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): |
88 setShaderGlobal(scene, "time", getShaderGlobal[float32](scene, "time") + 0.0005'f) | 88 setShaderGlobal(scene, "time", getShaderGlobal[float32](scene, "time") + 0.0005'f) |
89 myengine.renderScene(scene) | 89 myengine.renderScene(scene) |