518 lines
22 KiB
Zig
518 lines
22 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const FPoint = extern struct {
|
|
x: f32,
|
|
y: f32,
|
|
};
|
|
|
|
pub const PixelFormat = enum(c_int) {
|
|
pixelformatYv12, //Planar mode: Y + V + U (3 planes)
|
|
pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
|
|
pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
|
|
pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
|
|
pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
|
|
pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
|
|
pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
|
|
pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
|
|
pixelformatExternalOes, //Android video texture format
|
|
pixelformatMjpg, //Motion JPEG
|
|
};
|
|
|
|
pub const FColor = extern struct {
|
|
r: f32,
|
|
g: f32,
|
|
b: f32,
|
|
a: f32,
|
|
};
|
|
|
|
pub const Surface = opaque {
|
|
pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer {
|
|
return c.SDL_CreateSoftwareRenderer(surface);
|
|
}
|
|
};
|
|
|
|
pub const ScaleMode = enum(c_int) {
|
|
scalemodeNearest, //nearest pixel sampling
|
|
scalemodeLinear, //linear filtering
|
|
};
|
|
|
|
pub const PropertiesID = u32;
|
|
|
|
pub const BlendMode = u32;
|
|
|
|
pub const Window = opaque {
|
|
pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer {
|
|
return c.SDL_CreateRenderer(window, name);
|
|
}
|
|
|
|
pub inline fn getRenderer(window: *Window) ?*Renderer {
|
|
return c.SDL_GetRenderer(window);
|
|
}
|
|
};
|
|
|
|
pub const FRect = extern struct {
|
|
x: f32,
|
|
y: f32,
|
|
w: f32,
|
|
h: f32,
|
|
};
|
|
|
|
pub const Event = extern union {
|
|
_type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration
|
|
common: CommonEvent, // Common event data
|
|
display: DisplayEvent, // Display event data
|
|
window: WindowEvent, // Window event data
|
|
kdevice: KeyboardDeviceEvent, // Keyboard device change event data
|
|
key: KeyboardEvent, // Keyboard event data
|
|
edit: TextEditingEvent, // Text editing event data
|
|
edit_candidates: TextEditingCandidatesEvent, // Text editing candidates event data
|
|
text: TextInputEvent, // Text input event data
|
|
mdevice: MouseDeviceEvent, // Mouse device change event data
|
|
motion: MouseMotionEvent, // Mouse motion event data
|
|
button: MouseButtonEvent, // Mouse button event data
|
|
wheel: MouseWheelEvent, // Mouse wheel event data
|
|
jdevice: JoyDeviceEvent, // Joystick device change event data
|
|
jaxis: JoyAxisEvent, // Joystick axis event data
|
|
jball: JoyBallEvent, // Joystick ball event data
|
|
jhat: JoyHatEvent, // Joystick hat event data
|
|
jbutton: JoyButtonEvent, // Joystick button event data
|
|
jbattery: JoyBatteryEvent, // Joystick battery event data
|
|
gdevice: GamepadDeviceEvent, // Gamepad device event data
|
|
gaxis: GamepadAxisEvent, // Gamepad axis event data
|
|
gbutton: GamepadButtonEvent, // Gamepad button event data
|
|
gtouchpad: GamepadTouchpadEvent, // Gamepad touchpad event data
|
|
gsensor: GamepadSensorEvent, // Gamepad sensor event data
|
|
adevice: AudioDeviceEvent, // Audio device event data
|
|
cdevice: CameraDeviceEvent, // Camera device event data
|
|
sensor: SensorEvent, // Sensor event data
|
|
quit: QuitEvent, // Quit request event data
|
|
user: UserEvent, // Custom event data
|
|
tfinger: TouchFingerEvent, // Touch finger event data
|
|
pproximity: PenProximityEvent, // Pen proximity event data
|
|
ptouch: PenTouchEvent, // Pen tip touching event data
|
|
pmotion: PenMotionEvent, // Pen motion event data
|
|
pbutton: PenButtonEvent, // Pen button event data
|
|
paxis: PenAxisEvent, // Pen axis event data
|
|
render: RenderEvent, // Render event data
|
|
drop: DropEvent, // Drag and drop event data
|
|
clipboard: ClipboardEvent, // Clipboard event data
|
|
padding: [128]u8,
|
|
};
|
|
|
|
pub const FlipMode = enum(c_int) {
|
|
flipNone, //Do not flip
|
|
flipHorizontal, //flip horizontally
|
|
flipVertical, //flip vertically
|
|
};
|
|
|
|
pub const Rect = extern struct {
|
|
x: c_int,
|
|
y: c_int,
|
|
w: c_int,
|
|
h: c_int,
|
|
};
|
|
|
|
pub const WindowFlags = packed struct(u64) {
|
|
windowFullscreen: bool = false, // window is in fullscreen mode
|
|
windowOpengl: bool = false, // window usable with OpenGL context
|
|
windowOccluded: bool = false, // window is occluded
|
|
windowHidden: bool = false, // window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible
|
|
windowBorderless: bool = false, // no window decoration
|
|
windowResizable: bool = false, // window can be resized
|
|
windowMinimized: bool = false, // window is minimized
|
|
windowMaximized: bool = false, // window is maximized
|
|
windowMouseGrabbed: bool = false, // window has grabbed mouse input
|
|
windowInputFocus: bool = false, // window has input focus
|
|
windowMouseFocus: bool = false, // window has mouse focus
|
|
windowExternal: bool = false, // window not created by SDL
|
|
windowModal: bool = false, // window is modal
|
|
windowHighPixelDensity: bool = false, // window uses high pixel density back buffer if possible
|
|
windowMouseCapture: bool = false, // window has mouse captured (unrelated to MOUSE_GRABBED)
|
|
windowMouseRelativeMode: bool = false, // window has relative mode enabled
|
|
windowAlwaysOnTop: bool = false, // window should always be above others
|
|
windowUtility: bool = false, // window should be treated as a utility window, not showing in the task bar and window list
|
|
windowTooltip: bool = false, // window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window
|
|
windowPopupMenu: bool = false, // window should be treated as a popup menu, requires a parent window
|
|
windowKeyboardGrabbed: bool = false, // window has grabbed keyboard input
|
|
windowVulkan: bool = false, // window usable for Vulkan surface
|
|
windowMetal: bool = false, // window usable for Metal view
|
|
windowTransparent: bool = false, // window with transparent buffer
|
|
windowNotFocusable: bool = false, // window should not be focusable
|
|
pad0: u38 = 0,
|
|
rsvd: bool = false,
|
|
};
|
|
|
|
pub const Vertex = extern struct {
|
|
position: FPoint, // Vertex position, in SDL_Renderer coordinates
|
|
color: FColor, // Vertex color
|
|
tex_coord: FPoint, // Normalized texture coordinates, if needed
|
|
};
|
|
|
|
pub const TextureAccess = enum(c_int) {
|
|
textureaccessStatic, //Changes rarely, not lockable
|
|
textureaccessStreaming, //Changes frequently, lockable
|
|
textureaccessTarget, //Texture can be used as a render target
|
|
};
|
|
|
|
pub const RendererLogicalPresentation = enum(c_int) {
|
|
logicalPresentationDisabled, //There is no logical size in effect
|
|
logicalPresentationStretch, //The rendered content is stretched to the output resolution
|
|
logicalPresentationLetterbox, //The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars
|
|
logicalPresentationOverscan, //The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds
|
|
logicalPresentationIntegerScale, //The rendered content is scaled up by integer multiples to fit the output resolution
|
|
};
|
|
|
|
pub const Renderer = opaque {
|
|
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
|
|
return c.SDL_GetRenderWindow(renderer);
|
|
}
|
|
|
|
pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 {
|
|
return c.SDL_GetRendererName(renderer);
|
|
}
|
|
|
|
pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID {
|
|
return c.SDL_GetRendererProperties(renderer);
|
|
}
|
|
|
|
pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
|
|
return c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h));
|
|
}
|
|
|
|
pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
|
|
return c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h));
|
|
}
|
|
|
|
pub inline fn createTexture(renderer: *Renderer, format: PixelFormat, access: TextureAccess, w: c_int, h: c_int) ?*Texture {
|
|
return c.SDL_CreateTexture(renderer, @bitCast(format), access, w, h);
|
|
}
|
|
|
|
pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture {
|
|
return c.SDL_CreateTextureFromSurface(renderer, surface);
|
|
}
|
|
|
|
pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture {
|
|
return c.SDL_CreateTextureWithProperties(renderer, props);
|
|
}
|
|
|
|
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
|
|
return c.SDL_SetRenderTarget(renderer, texture);
|
|
}
|
|
|
|
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
|
|
return c.SDL_GetRenderTarget(renderer);
|
|
}
|
|
|
|
pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool {
|
|
return c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode);
|
|
}
|
|
|
|
pub inline fn getRenderLogicalPresentation(renderer: *Renderer, w: *c_int, h: *c_int, mode: ?*RendererLogicalPresentation) bool {
|
|
return c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode);
|
|
}
|
|
|
|
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
|
|
return c.SDL_GetRenderLogicalPresentationRect(renderer, rect);
|
|
}
|
|
|
|
pub inline fn renderCoordinatesFromWindow(renderer: *Renderer, window_x: f32, window_y: f32, x: *f32, y: *f32) bool {
|
|
return c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y));
|
|
}
|
|
|
|
pub inline fn renderCoordinatesToWindow(renderer: *Renderer, x: f32, y: f32, window_x: *f32, window_y: *f32) bool {
|
|
return c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y));
|
|
}
|
|
|
|
pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool {
|
|
return c.SDL_ConvertEventToRenderCoordinates(renderer, event);
|
|
}
|
|
|
|
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool {
|
|
return c.SDL_SetRenderViewport(renderer, @ptrCast(rect));
|
|
}
|
|
|
|
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
|
|
return c.SDL_GetRenderViewport(renderer, rect);
|
|
}
|
|
|
|
pub inline fn renderViewportSet(renderer: *Renderer) bool {
|
|
return c.SDL_RenderViewportSet(renderer);
|
|
}
|
|
|
|
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
|
|
return c.SDL_GetRenderSafeArea(renderer, rect);
|
|
}
|
|
|
|
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool {
|
|
return c.SDL_SetRenderClipRect(renderer, @ptrCast(rect));
|
|
}
|
|
|
|
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
|
|
return c.SDL_GetRenderClipRect(renderer, rect);
|
|
}
|
|
|
|
pub inline fn renderClipEnabled(renderer: *Renderer) bool {
|
|
return c.SDL_RenderClipEnabled(renderer);
|
|
}
|
|
|
|
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
|
|
return c.SDL_SetRenderScale(renderer, scaleX, scaleY);
|
|
}
|
|
|
|
pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool {
|
|
return c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY));
|
|
}
|
|
|
|
pub inline fn setRenderDrawColor(renderer: *Renderer, r: u8, g: u8, b: u8, a: u8) bool {
|
|
return c.SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
|
}
|
|
|
|
pub inline fn setRenderDrawColorFloat(renderer: *Renderer, r: f32, g: f32, b: f32, a: f32) bool {
|
|
return c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a);
|
|
}
|
|
|
|
pub inline fn getRenderDrawColor(renderer: *Renderer, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
|
|
return c.SDL_GetRenderDrawColor(renderer, r, g, b, a);
|
|
}
|
|
|
|
pub inline fn getRenderDrawColorFloat(renderer: *Renderer, r: *f32, g: *f32, b: *f32, a: *f32) bool {
|
|
return c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a));
|
|
}
|
|
|
|
pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool {
|
|
return c.SDL_SetRenderColorScale(renderer, scale);
|
|
}
|
|
|
|
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
|
|
return c.SDL_GetRenderColorScale(renderer, @ptrCast(scale));
|
|
}
|
|
|
|
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
|
|
return c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode));
|
|
}
|
|
|
|
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
|
|
return c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode));
|
|
}
|
|
|
|
pub inline fn renderClear(renderer: *Renderer) bool {
|
|
return c.SDL_RenderClear(renderer);
|
|
}
|
|
|
|
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
|
|
return c.SDL_RenderPoint(renderer, x, y);
|
|
}
|
|
|
|
pub inline fn renderPoints(renderer: *Renderer, points: *const FPoint, count: c_int) bool {
|
|
return c.SDL_RenderPoints(renderer, @ptrCast(points), count);
|
|
}
|
|
|
|
pub inline fn renderLine(renderer: *Renderer, x1: f32, y1: f32, x2: f32, y2: f32) bool {
|
|
return c.SDL_RenderLine(renderer, x1, y1, x2, y2);
|
|
}
|
|
|
|
pub inline fn renderLines(renderer: *Renderer, points: *const FPoint, count: c_int) bool {
|
|
return c.SDL_RenderLines(renderer, @ptrCast(points), count);
|
|
}
|
|
|
|
pub inline fn renderRect(renderer: *Renderer, rect: *const FRect) bool {
|
|
return c.SDL_RenderRect(renderer, @ptrCast(rect));
|
|
}
|
|
|
|
pub inline fn renderRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool {
|
|
return c.SDL_RenderRects(renderer, @ptrCast(rects), count);
|
|
}
|
|
|
|
pub inline fn renderFillRect(renderer: *Renderer, rect: *const FRect) bool {
|
|
return c.SDL_RenderFillRect(renderer, @ptrCast(rect));
|
|
}
|
|
|
|
pub inline fn renderFillRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool {
|
|
return c.SDL_RenderFillRects(renderer, @ptrCast(rects), count);
|
|
}
|
|
|
|
pub inline fn renderTexture(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, dstrect: *const FRect) bool {
|
|
return c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect));
|
|
}
|
|
|
|
pub inline fn renderTextureRotated(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, dstrect: *const FRect, angle: f64, center: *const FPoint, flip: FlipMode) bool {
|
|
return c.SDL_RenderTextureRotated(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip));
|
|
}
|
|
|
|
pub inline fn renderTextureAffine(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, origin: *const FPoint, right: *const FPoint, down: *const FPoint) bool {
|
|
return c.SDL_RenderTextureAffine(renderer, texture, @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down));
|
|
}
|
|
|
|
pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, scale: f32, dstrect: *const FRect) bool {
|
|
return c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect));
|
|
}
|
|
|
|
pub inline fn renderTexture9Grid(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, left_width: f32, right_width: f32, top_height: f32, bottom_height: f32, scale: f32, dstrect: *const FRect) bool {
|
|
return c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect));
|
|
}
|
|
|
|
pub inline fn renderGeometry(renderer: *Renderer, texture: ?*Texture, vertices: *const Vertex, num_vertices: c_int, indices: [*c]const c_int, num_indices: c_int) bool {
|
|
return c.SDL_RenderGeometry(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices);
|
|
}
|
|
|
|
pub inline fn renderGeometryRaw(renderer: *Renderer, texture: ?*Texture, xy: *const f32, xy_stride: c_int, color: *const FColor, color_stride: c_int, uv: *const f32, uv_stride: c_int, num_vertices: c_int, indices: ?*const anyopaque, num_indices: c_int, size_indices: c_int) bool {
|
|
return c.SDL_RenderGeometryRaw(renderer, texture, @ptrCast(xy), xy_stride, @ptrCast(color), color_stride, @ptrCast(uv), uv_stride, num_vertices, indices, num_indices, size_indices);
|
|
}
|
|
|
|
pub inline fn renderReadPixels(renderer: *Renderer, rect: *const Rect) ?*Surface {
|
|
return c.SDL_RenderReadPixels(renderer, @ptrCast(rect));
|
|
}
|
|
|
|
pub inline fn renderPresent(renderer: *Renderer) bool {
|
|
return c.SDL_RenderPresent(renderer);
|
|
}
|
|
|
|
pub inline fn destroyRenderer(renderer: *Renderer) void {
|
|
return c.SDL_DestroyRenderer(renderer);
|
|
}
|
|
|
|
pub inline fn flushRenderer(renderer: *Renderer) bool {
|
|
return c.SDL_FlushRenderer(renderer);
|
|
}
|
|
|
|
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
|
|
return c.SDL_GetRenderMetalLayer(renderer);
|
|
}
|
|
|
|
pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque {
|
|
return c.SDL_GetRenderMetalCommandEncoder(renderer);
|
|
}
|
|
|
|
pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool {
|
|
return c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore);
|
|
}
|
|
|
|
pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool {
|
|
return c.SDL_SetRenderVSync(renderer, vsync);
|
|
}
|
|
|
|
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
|
|
return c.SDL_GetRenderVSync(renderer, @ptrCast(vsync));
|
|
}
|
|
|
|
pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool {
|
|
return c.SDL_RenderDebugText(renderer, x, y, str);
|
|
}
|
|
|
|
pub inline fn renderDebugTextFormat(renderer: *Renderer, x: f32, y: f32, fmt: [*c]const u8, ...) bool {
|
|
return c.SDL_RenderDebugTextFormat(
|
|
renderer,
|
|
x,
|
|
y,
|
|
fmt,
|
|
);
|
|
}
|
|
};
|
|
|
|
pub const Texture = opaque {
|
|
pub inline fn getTextureProperties(texture: *Texture) PropertiesID {
|
|
return c.SDL_GetTextureProperties(texture);
|
|
}
|
|
|
|
pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer {
|
|
return c.SDL_GetRendererFromTexture(texture);
|
|
}
|
|
|
|
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
|
|
return c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h));
|
|
}
|
|
|
|
pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool {
|
|
return c.SDL_SetTextureColorMod(texture, r, g, b);
|
|
}
|
|
|
|
pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool {
|
|
return c.SDL_SetTextureColorModFloat(texture, r, g, b);
|
|
}
|
|
|
|
pub inline fn getTextureColorMod(texture: *Texture, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
|
|
return c.SDL_GetTextureColorMod(texture, r, g, b);
|
|
}
|
|
|
|
pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool {
|
|
return c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b));
|
|
}
|
|
|
|
pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool {
|
|
return c.SDL_SetTextureAlphaMod(texture, alpha);
|
|
}
|
|
|
|
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
|
|
return c.SDL_SetTextureAlphaModFloat(texture, alpha);
|
|
}
|
|
|
|
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
|
|
return c.SDL_GetTextureAlphaMod(texture, alpha);
|
|
}
|
|
|
|
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
|
|
return c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha));
|
|
}
|
|
|
|
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
|
|
return c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode));
|
|
}
|
|
|
|
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
|
|
return c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode));
|
|
}
|
|
|
|
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
|
|
return c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode));
|
|
}
|
|
|
|
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
|
|
return c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode));
|
|
}
|
|
|
|
pub inline fn updateTexture(texture: *Texture, rect: *const Rect, pixels: ?*const anyopaque, pitch: c_int) bool {
|
|
return c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch);
|
|
}
|
|
|
|
pub inline fn updateYUVTexture(texture: *Texture, rect: *const Rect, Yplane: [*c]const u8, Ypitch: c_int, Uplane: [*c]const u8, Upitch: c_int, Vplane: [*c]const u8, Vpitch: c_int) bool {
|
|
return c.SDL_UpdateYUVTexture(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
|
|
}
|
|
|
|
pub inline fn updateNVTexture(texture: *Texture, rect: *const Rect, Yplane: [*c]const u8, Ypitch: c_int, UVplane: [*c]const u8, UVpitch: c_int) bool {
|
|
return c.SDL_UpdateNVTexture(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch);
|
|
}
|
|
|
|
pub inline fn lockTexture(texture: *Texture, rect: *const Rect, pixels: [*c]?*anyopaque, pitch: *c_int) bool {
|
|
return c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch));
|
|
}
|
|
|
|
pub inline fn lockTextureToSurface(texture: *Texture, rect: *const Rect, surface: [*c][*c]Surface) bool {
|
|
return c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface);
|
|
}
|
|
|
|
pub inline fn unlockTexture(texture: *Texture) void {
|
|
return c.SDL_UnlockTexture(texture);
|
|
}
|
|
|
|
pub inline fn destroyTexture(texture: *Texture) void {
|
|
return c.SDL_DestroyTexture(texture);
|
|
}
|
|
};
|
|
|
|
pub inline fn getNumRenderDrivers() c_int {
|
|
return c.SDL_GetNumRenderDrivers();
|
|
}
|
|
|
|
pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
|
|
return c.SDL_GetRenderDriver(index);
|
|
}
|
|
|
|
pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: c_int, window_flags: WindowFlags, window: [*c][*c]Window, renderer: [*c][*c]Renderer) bool {
|
|
return c.SDL_CreateWindowAndRenderer(title, width, height, @bitCast(window_flags), window, renderer);
|
|
}
|
|
|
|
pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer {
|
|
return c.SDL_CreateRendererWithProperties(props);
|
|
}
|