Ejemplo n.º 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)
}
Ejemplo n.º 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
}
Ejemplo n.º 3
0
func (event *Event) WaitTimeout(timeout int) bool {
	ret := C.SDL_WaitEventTimeout((*C.SDL_Event)(cast(event)), C.int(timeout))
	return ret != 0
}