func (_ *NgLoop) onThreadWin() { Stats.FrameWinThread.begin() if glfw.PollEvents(); glfw.WindowParam(glfw.Opened) == 1 { Loop.On.WinThread() } else { Loop.Running = false } Stats.FrameWinThread.end() }
func Run() { running = true for running { start := time.Now() escPressed := glfw.Key(glfw.KeyEsc) windowOpen := glfw.WindowParam(glfw.Opened) running = escPressed == 0 && windowOpen == 1 select { case data := <-ScreenOutputChan: drawFrame(data.Pixels) drawInfoBox(3, 3, 12, data.IterNr, data.NThreads, data.ExecTime) glfw.SwapBuffers() default: // Non blocking! glfw.PollEvents() } // Limit to 60hz elapsed := time.Since(start) timeToSleep := 16*time.Millisecond - elapsed if timeToSleep > 0 { time.Sleep(timeToSleep) } } }
func (me *context) PollEvents() { glfw.PollEvents() }