Exemple #1
0
// IntersectLine
func (rect *Rect) IntersectLine(X1, Y1, X2, Y2 *int) bool {
	_X1 := (*C.int)(unsafe.Pointer(X1))
	_Y1 := (*C.int)(unsafe.Pointer(Y1))
	_X2 := (*C.int)(unsafe.Pointer(X2))
	_Y2 := (*C.int)(unsafe.Pointer(Y2))
	return C.SDL_IntersectRectAndLine(rect.cptr(), _X1, _Y1, _X2, _Y2) > 0
}
Exemple #2
0
func (r *Rect) IntersectRectAndLine(x1, y1, x2, y2 *int) bool {
	cx1 := (*C.int)(unsafe.Pointer(x1))
	cy1 := (*C.int)(unsafe.Pointer(y1))
	cx2 := (*C.int)(unsafe.Pointer(x2))
	cy2 := (*C.int)(unsafe.Pointer(y2))

	return C.SDL_IntersectRectAndLine(r.c(), cx1, cy1, cx2, cy2) == C.SDL_TRUE
}
Exemple #3
0
// Calculate the intersection of a rectangle and line segment.
// Return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
func (r *Rect) IntersectLine(x1, y1, x2, y2 *int32) bool {
	ret := C.SDL_IntersectRectAndLine((*C.SDL_Rect)(unsafe.Pointer(r)), (*C.int)(unsafe.Pointer(x1)), (*C.int)(unsafe.Pointer(y1)), (*C.int)(unsafe.Pointer(x2)), (*C.int)(unsafe.Pointer(y2)))
	return ret == C.SDL_TRUE
}