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

Function mobileDraw

engo_mobile_bind.go:139–169  ·  view source on GitHub ↗

mobileDraw runs once per frame. RunIteration for the other backends

(defaultScene Scene)

Source from the content-addressed store, hash-verified

137
138// mobileDraw runs once per frame. RunIteration for the other backends
139func mobileDraw(defaultScene Scene) {
140 if !initalized {
141 var ctx mgl.Context
142 ctx, worker = mgl.NewContext()
143 Gl = gl.NewContext(ctx)
144 }
145 <-drawEvent
146 defer func() {
147 drawDone <- struct{}{}
148 }()
149
150 if !initalized {
151 RunPreparation(defaultScene)
152 ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit))
153 initalized = true
154 }
155
156 select {
157 case <-ticker.C:
158 case <-resetLoopTicker:
159 ticker.Stop()
160 ticker = time.NewTicker(time.Duration(int(time.Second) / opts.FPSLimit))
161 }
162 Time.Tick()
163 if !opts.HeadlessMode {
164 Input.update()
165 }
166 // Then update the world and all Systems
167 currentUpdater.Update(Time.Delta())
168 Input.Mouse.Action = Neutral
169}
170
171//MobileStop handles when the game is closed
172func MobileStop() {

Callers 1

runLoopFunction · 0.85

Calls 5

TickMethod · 0.80
DeltaMethod · 0.80
RunPreparationFunction · 0.70
UpdateMethod · 0.65
updateMethod · 0.45

Tested by

no test coverage detected