Mercurial > games > semicongine
diff examples/E04_input.nim @ 800:668eed376029
add: nice mesh API, fix: copying of whole scenedata all the time
author | Sam <sam@basx.dev> |
---|---|
date | Thu, 07 Sep 2023 23:28:36 +0700 |
parents | 812b5e28f441 |
children | c66503386e8b |
line wrap: on
line diff
--- a/examples/E04_input.nim Wed Sep 06 00:03:51 2023 +0700 +++ b/examples/E04_input.nim Thu Sep 07 23:28:36 2023 +0700 @@ -188,16 +188,16 @@ for (index, key) in enumerate(keyIndices): if myengine.keyWasPressed(key): let baseIndex = index * 4 - keyboardmesh[].updateAttributeData("color", baseIndex + 0, activeColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 1, activeColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 2, activeColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 3, activeColor) + keyboardmesh["color", baseIndex + 0] = activeColor + keyboardmesh["color", baseIndex + 1] = activeColor + keyboardmesh["color", baseIndex + 2] = activeColor + keyboardmesh["color", baseIndex + 3] = activeColor if myengine.keyWasReleased(key): let baseIndex = index * 4 - keyboardmesh[].updateAttributeData("color", baseIndex + 0, baseColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 1, baseColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 2, baseColor) - keyboardmesh[].updateAttributeData("color", baseIndex + 3, baseColor) + keyboardmesh["color", baseIndex + 0] = baseColor + keyboardmesh["color", baseIndex + 1] = baseColor + keyboardmesh["color", baseIndex + 2] = baseColor + keyboardmesh["color", baseIndex + 3] = baseColor myengine.renderScene(scene)