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

Function runLoop

engo_js.go:367–388  ·  view source on GitHub ↗
(defaultScene Scene, headless bool)

Source from the content-addressed store, hash-verified

365}
366
367func runLoop(defaultScene Scene, headless bool) {
368 SetScene(defaultScene, false)
369 RunPreparation()
370 ticker := time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit))
371
372 // Start tick, minimize the delta
373 Time.Tick()
374
375 for {
376 select {
377 case <-ticker.C:
378 RunIteration()
379 case <-resetLoopTicker:
380 ticker.Stop()
381 ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit))
382 case <-closeGame:
383 ticker.Stop()
384 closeEvent()
385 return
386 }
387 }
388}
389
390func openFile(url string) (io.ReadCloser, error) {
391 if Headless() { // Headless would be node.js

Callers 2

RunFunction · 0.70
runHeadlessFunction · 0.70

Calls 5

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

Tested by

no test coverage detected