Example #1
0
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
	}
}
Example #2
0
//Used to manually draw the screen.
func Draw() {
	var e C.SDL_Event
	C.setEventType(&e, Event_DrawEvent)
	C.SDL_PushEvent(&e)
	<-drawComplete
}