Beispiel #1
0
// WaitEventTimeout (https://wiki.libsdl.org/SDL_WaitEventTimeout)
func WaitEventTimeout(timeout int) Event {
	var cevent CEvent
	_event := (*C.SDL_Event)(unsafe.Pointer(&cevent))
	ok := int(C.SDL_WaitEventTimeout(_event, C.int(timeout)))
	if ok == 0 {
		return nil
	}
	return goEvent(&cevent)
}
Beispiel #2
0
func WaitEventTimeout(ev *Event, timeout time.Duration) error {
	evLock.Lock()
	defer evLock.Unlock()

	if C.SDL_WaitEventTimeout(evCache.c(), C.int(timeout/time.Millisecond)) == 0 {
		return getError()
	}

	return nil
}
Beispiel #3
0
func (event *Event) WaitTimeout(timeout int) bool {
	ret := C.SDL_WaitEventTimeout((*C.SDL_Event)(cast(event)), C.int(timeout))
	return ret != 0
}