(defaultScene Scene, headless bool)
| 247 | } |
| 248 | |
| 249 | func runLoop(defaultScene Scene, headless bool) { |
| 250 | c := make(chan os.Signal, 1) |
| 251 | signal.Notify(c, os.Interrupt) |
| 252 | signal.Notify(c, syscall.SIGTERM) |
| 253 | go func() { |
| 254 | <-c |
| 255 | closeEvent() |
| 256 | }() |
| 257 | |
| 258 | RunPreparation(defaultScene) |
| 259 | ticker := time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 260 | |
| 261 | // Start tick, minimize the delta |
| 262 | Time.Tick() |
| 263 | |
| 264 | for { |
| 265 | select { |
| 266 | case <-ticker.C: |
| 267 | RunIteration() |
| 268 | case <-resetLoopTicker: |
| 269 | ticker.Stop() |
| 270 | ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit)) |
| 271 | case <-closeGame: |
| 272 | ticker.Stop() |
| 273 | closeEvent() |
| 274 | return |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | // CursorPos returns the current cursor position |
| 280 | func CursorPos() (x, y float32) { |
nothing calls this directly
no test coverage detected