Mercurial > games > semicongine
comparison examples/E04_input.nim @ 339:55c9183f7ece
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 | 887ddc8d45fd |
children | c66503386e8b |
comparison
equal
deleted
inserted
replaced
338:e5aca33dea19 | 339:55c9183f7ece |
---|---|
186 cursormesh.transform = mousePos | 186 cursormesh.transform = mousePos |
187 | 187 |
188 for (index, key) in enumerate(keyIndices): | 188 for (index, key) in enumerate(keyIndices): |
189 if myengine.keyWasPressed(key): | 189 if myengine.keyWasPressed(key): |
190 let baseIndex = index * 4 | 190 let baseIndex = index * 4 |
191 keyboardmesh[].updateAttributeData("color", baseIndex + 0, activeColor) | 191 keyboardmesh["color", baseIndex + 0] = activeColor |
192 keyboardmesh[].updateAttributeData("color", baseIndex + 1, activeColor) | 192 keyboardmesh["color", baseIndex + 1] = activeColor |
193 keyboardmesh[].updateAttributeData("color", baseIndex + 2, activeColor) | 193 keyboardmesh["color", baseIndex + 2] = activeColor |
194 keyboardmesh[].updateAttributeData("color", baseIndex + 3, activeColor) | 194 keyboardmesh["color", baseIndex + 3] = activeColor |
195 if myengine.keyWasReleased(key): | 195 if myengine.keyWasReleased(key): |
196 let baseIndex = index * 4 | 196 let baseIndex = index * 4 |
197 keyboardmesh[].updateAttributeData("color", baseIndex + 0, baseColor) | 197 keyboardmesh["color", baseIndex + 0] = baseColor |
198 keyboardmesh[].updateAttributeData("color", baseIndex + 1, baseColor) | 198 keyboardmesh["color", baseIndex + 1] = baseColor |
199 keyboardmesh[].updateAttributeData("color", baseIndex + 2, baseColor) | 199 keyboardmesh["color", baseIndex + 2] = baseColor |
200 keyboardmesh[].updateAttributeData("color", baseIndex + 3, baseColor) | 200 keyboardmesh["color", baseIndex + 3] = baseColor |
201 | 201 |
202 myengine.renderScene(scene) | 202 myengine.renderScene(scene) |
203 | 203 |
204 myengine.destroy() | 204 myengine.destroy() |