예제 #1
0
파일: events.go 프로젝트: willemvds/sdl
func PeepEvents(events []Event, action Eventaction, min, max uint32) (int, error) {
	cevents := make([]cEvent, len(events))
	n := C.SDL_PeepEvents(
		(*C.SDL_Event)(unsafe.Pointer(&cevents[0])),
		C.int(len(cevents)),
		C.SDL_eventaction(action),
		C.Uint32(min),
		C.Uint32(max),
	)
	if n < 0 {
		return 0, getError()
	}

	for i := 0; i < int(n); i++ {
		events[i] = cevents[i].toGo()
	}

	return int(n), nil
}
예제 #2
0
파일: events.go 프로젝트: flazz/go-sdl2
func (action EventAction) c() C.SDL_eventaction {
	return C.SDL_eventaction(action)
}