RunIteration runs one iteration per frame
()
| 296 | |
| 297 | // RunIteration runs one iteration per frame |
| 298 | func RunIteration() { |
| 299 | Time.Tick() |
| 300 | Input.update() |
| 301 | jsPollKeys() |
| 302 | currentUpdater.Update(Time.Delta()) |
| 303 | Input.Mouse.Action = Neutral |
| 304 | // TODO: this may not work, and sky-rocket the FPS |
| 305 | // requestAnimationFrame(func(dt float32) { |
| 306 | // currentWorld.Update(Time.Delta()) |
| 307 | // keysUpdate() |
| 308 | // if !headless { |
| 309 | // // TODO: does this require !headless? |
| 310 | // Mouse.ScrollX, Mouse.ScrollY = 0, 0 |
| 311 | // } |
| 312 | // Time.Tick() |
| 313 | // }) |
| 314 | } |
| 315 | |
| 316 | // jsPollKeys polls the keys collected by the javascript callback |
| 317 | // this ensures the keys only get updated once per frame, since the |