(defaultScene Scene, headless bool)
| 291 | } |
| 292 | |
| 293 | func runLoop(defaultScene Scene, headless bool) { |
| 294 | c := make(chan os.Signal, 1) |
| 295 | signal.Notify(c, os.Interrupt) |
| 296 | signal.Notify(c, syscall.SIGTERM) |
| 297 | go func() { |
| 298 | <-c |
| 299 | closeEvent() |
| 300 | }() |
| 301 | |
| 302 | RunPreparation(defaultScene) |
| 303 | ticker := time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 304 | |
| 305 | // Start tick, minimize the delta |
| 306 | Time.Tick() |
| 307 | |
| 308 | for { |
| 309 | select { |
| 310 | case <-ticker.C: |
| 311 | RunIteration() |
| 312 | case <-resetLoopTicker: |
| 313 | ticker.Stop() |
| 314 | ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 315 | case <-closeGame: |
| 316 | ticker.Stop() |
| 317 | closeEvent() |
| 318 | return |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | // CursorPos returns the current cursor position |
| 324 | func CursorPos() (x, y float32) { |
nothing calls this directly
no test coverage detected