comparison 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
comparison
equal deleted inserted replaced
799:7ce4e28c71dd 800:668eed376029
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()