(defaultScene Scene, headless bool)
| 54 | } |
| 55 | |
| 56 | func runLoop(defaultScene Scene, headless bool) { |
| 57 | c := make(chan os.Signal, 1) |
| 58 | signal.Notify(c, os.Interrupt) |
| 59 | signal.Notify(c, syscall.SIGTERM) |
| 60 | go func() { |
| 61 | <-c |
| 62 | closeEvent() |
| 63 | }() |
| 64 | |
| 65 | RunPreparation(defaultScene) |
| 66 | ticker := time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 67 | |
| 68 | // Start tick, minimize the delta |
| 69 | Time.Tick() |
| 70 | |
| 71 | for { |
| 72 | select { |
| 73 | case <-ticker.C: |
| 74 | RunIteration() |
| 75 | case <-resetLoopTicker: |
| 76 | ticker.Stop() |
| 77 | ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 78 | case <-closeGame: |
| 79 | ticker.Stop() |
| 80 | closeEvent() |
| 81 | return |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // CursorPos returns (0, 0) because there is no cursor |
| 87 | func CursorPos() (x, y float32) { |
nothing calls this directly
no test coverage detected