66 lines
2.5 KiB
Zig
66 lines
2.5 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
pub const Point = extern struct {
|
|
x: c_int,
|
|
y: c_int,
|
|
};
|
|
|
|
pub const FPoint = extern struct {
|
|
x: f32,
|
|
y: f32,
|
|
};
|
|
|
|
pub const Rect = extern struct {
|
|
x: c_int,
|
|
y: c_int,
|
|
w: c_int,
|
|
h: c_int,
|
|
};
|
|
|
|
pub const FRect = extern struct {
|
|
x: f32,
|
|
y: f32,
|
|
w: f32,
|
|
h: f32,
|
|
};
|
|
|
|
pub inline fn hasRectIntersection(A: ?*const Rect, B: ?*const Rect) bool {
|
|
return @bitCast(c.SDL_HasRectIntersection(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B))));
|
|
}
|
|
|
|
pub inline fn getRectIntersection(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
|
|
return @bitCast(c.SDL_GetRectIntersection(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectUnion(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
|
|
return @bitCast(c.SDL_GetRectUnion(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectEnclosingPoints(points: ?*const Point, count: c_int, clip: ?*const Rect, result: ?*Rect) bool {
|
|
return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(@alignCast(points)), count, @ptrCast(@alignCast(clip)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectAndLineIntersection(rect: ?*const Rect, X1: ?*c_int, Y1: ?*c_int, X2: ?*c_int, Y2: ?*c_int) bool {
|
|
return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(@alignCast(rect)), X1, Y1, X2, Y2));
|
|
}
|
|
|
|
pub inline fn hasRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect) bool {
|
|
return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B))));
|
|
}
|
|
|
|
pub inline fn getRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
|
|
return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectUnionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
|
|
return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(@alignCast(A)), @ptrCast(@alignCast(B)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectEnclosingPointsFloat(points: ?*const FPoint, count: c_int, clip: ?*const FRect, result: ?*FRect) bool {
|
|
return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(@alignCast(points)), count, @ptrCast(@alignCast(clip)), @ptrCast(@alignCast(result))));
|
|
}
|
|
|
|
pub inline fn getRectAndLineIntersectionFloat(rect: ?*const FRect, X1: ?*f32, Y1: ?*f32, X2: ?*f32, Y2: ?*f32) bool {
|
|
return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(@alignCast(rect)), X1, Y1, X2, Y2));
|
|
}
|