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

Function runLoop

engo_empty.go:56–84  ·  view source on GitHub ↗
(defaultScene Scene, headless bool)

Source from the content-addressed store, hash-verified

54}
55
56func 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
87func 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