RunIteration runs one iteration per frame
()
| 263 | |
| 264 | // RunIteration runs one iteration per frame |
| 265 | func RunIteration() { |
| 266 | Time.Tick() |
| 267 | |
| 268 | // First check for new keypresses |
| 269 | if !opts.HeadlessMode { |
| 270 | Input.update() |
| 271 | glfw.PollEvents() |
| 272 | } |
| 273 | |
| 274 | // Then update the world and all Systems |
| 275 | currentUpdater.Update(Time.Delta()) |
| 276 | |
| 277 | // Lastly, forget keypresses and swap buffers |
| 278 | if !opts.HeadlessMode { |
| 279 | // reset values to avoid catching the same "signal" twice |
| 280 | Input.Mouse.ScrollX, Input.Mouse.ScrollY = 0, 0 |
| 281 | Input.Mouse.Action = Neutral |
| 282 | |
| 283 | Window.SwapBuffers() |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | // RunPreparation is called automatically when calling Open. It should only be called once. |
| 288 | func RunPreparation(defaultScene Scene) { |