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