Exemplo n.º 1
0
func (a *Rect) Intersect(b *Rect) *Rect {
	var ret Rect
	is := C.SDL_IntersectRect((*C.SDL_Rect)(unsafe.Pointer(a)), (*C.SDL_Rect)(unsafe.Pointer(b)), (*C.SDL_Rect)(unsafe.Pointer(&ret)))
	if is == C.SDL_TRUE {
		return &ret
	}
	return nil
}
Exemplo n.º 2
0
func (r *Rect) IntersectRect(r2 *Rect) *Rect {
	var rect Rect
	if C.SDL_IntersectRect(r.c(), r2.c(), rect.c()) == C.SDL_FALSE {
		return nil
	}

	return &rect
}
Exemplo n.º 3
0
func (a *Rect) Intersect(b, result *Rect) bool {
	_a := (*C.SDL_Rect)(unsafe.Pointer(a))
	_b := (*C.SDL_Rect)(unsafe.Pointer(b))
	_result := (*C.SDL_Rect)(unsafe.Pointer(result))
	return C.SDL_IntersectRect(_a, _b, _result) > 0
}
Exemplo n.º 4
0
// Rect (https://wiki.libsdl.org/SDL_IntersectRect)
func (a *Rect) Intersect(b *Rect) (result Rect, ok bool) {
	ok = C.SDL_IntersectRect(a.cptr(), b.cptr(), result.cptr()) > 0
	return
}
Exemplo n.º 5
0
func (a *Rect) Intersect(b, result *Rect) bool {
	return C.SDL_IntersectRect(a.cptr(), b.cptr(), result.cptr()) > 0
}