MCPcopy
hub / github.com/EngoEngine/engo / runLoop

Function runLoop

engo_glfw.go:293–321  ·  view source on GitHub ↗
(defaultScene Scene, headless bool)

Source from the content-addressed store, hash-verified

291}
292
293func 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
324func CursorPos() (x, y float32) {

Callers

nothing calls this directly

Calls 4

closeEventFunction · 0.85
TickMethod · 0.80
RunPreparationFunction · 0.70
RunIterationFunction · 0.70

Tested by

no test coverage detected