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

Function runLoop

engo_vulkan.go:244–272  ·  view source on GitHub ↗
(defaultScene Scene, headless bool)

Source from the content-addressed store, hash-verified

242}
243
244func 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
275func 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