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

Function runLoop

engo_sdl.go:249–277  ·  view source on GitHub ↗
(defaultScene Scene, headless bool)

Source from the content-addressed store, hash-verified

247}
248
249func 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
280func 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