示例#1
0
文件: sdl.go 项目: gtalent/starfish
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
	}
}
示例#2
0
文件: sdl.go 项目: gtalent/starfish
//Used to manually draw the screen.
func Draw() {
	var e C.SDL_Event
	C.setEventType(&e, Event_DrawEvent)
	C.SDL_PushEvent(&e)
	<-drawComplete
}