func runMainOp(f func()) { if isMainThread() { f() } else { var e C.SDL_Event C.setEventType(&e, Event_MainOpEvent) mainOpMutex.Lock() defer mainOpMutex.Unlock() C.SDL_PushEvent(&e) done := make(chan interface{}) op := func() { f() done <- nil } mainOpChan <- op <-done } }
//Used to manually draw the screen. func Draw() { var e C.SDL_Event C.setEventType(&e, Event_DrawEvent) C.SDL_PushEvent(&e) <-drawComplete }