RunIteration runs one iteration per frame
()
| 216 | |
| 217 | // RunIteration runs one iteration per frame |
| 218 | func RunIteration() { |
| 219 | Time.Tick() |
| 220 | |
| 221 | // First check for new keypresses |
| 222 | if !opts.HeadlessMode { |
| 223 | Input.update() |
| 224 | glfw.PollEvents() |
| 225 | } |
| 226 | |
| 227 | // Then update the world and all Systems |
| 228 | currentUpdater.Update(Time.Delta()) |
| 229 | |
| 230 | // Lastly, forget keypresses and swap buffers |
| 231 | if !opts.HeadlessMode { |
| 232 | // reset values to avoid catching the same "signal" twice |
| 233 | Input.Mouse.ScrollX, Input.Mouse.ScrollY = 0, 0 |
| 234 | Input.Mouse.Action = Neutral |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // RunPreparation is called automatically when calling Open. It should only be called once. |
| 239 | func RunPreparation(defaultScene Scene) { |