mobileDraw runs once per frame. RunIteration for the other backends
(defaultScene Scene)
| 137 | |
| 138 | // mobileDraw runs once per frame. RunIteration for the other backends |
| 139 | func 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 |
| 172 | func MobileStop() { |