Replace #by_ptr ... with Maybe(^...) where SDL API allows nil pointers

This commit is contained in:
sndb
2025-02-26 09:54:39 +03:00
parent cae91c9472
commit 5fc1984fd4
3 changed files with 14 additions and 14 deletions

View File

@@ -52,7 +52,7 @@ foreign lib {
TextInputActive :: proc(window: ^Window) -> bool ---
StopTextInput :: proc(window: ^Window) -> bool ---
ClearComposition :: proc(window: ^Window) -> bool ---
SetTextInputArea :: proc(window: ^Window, #by_ptr rect: Rect, cursor: c.int) -> bool ---
SetTextInputArea :: proc(window: ^Window, rect: Maybe(^Rect), cursor: c.int) -> bool ---
GetTextInputArea :: proc(window: ^Window, rect: ^Rect, cursor: ^c.int) -> bool ---
HasScreenKeyboardSupport :: proc() -> bool ---
ScreenKeyboardShown :: proc(window: ^Window) -> bool ---

View File

@@ -183,10 +183,10 @@ foreign lib {
RenderCoordinatesFromWindow :: proc(renderer: ^Renderer, window_x, window_y: f32, x, y: ^f32) -> bool ---
RenderCoordinatesToWindow :: proc(renderer: ^Renderer, x, y: f32, window_x, window_y: ^f32) -> bool ---
ConvertEventToRenderCoordinates :: proc(renderer: ^Renderer, event: ^Event) -> bool ---
SetRenderViewport :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> bool ---
SetRenderViewport :: proc(renderer: ^Renderer, rect: Maybe(^Rect)) -> bool ---
GetRenderViewport :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
GetRenderSafeArea :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
SetRenderClipRect :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> bool ---
SetRenderClipRect :: proc(renderer: ^Renderer, rect: Maybe(^Rect)) -> bool ---
GetRenderClipRect :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
SetRenderScale :: proc(renderer: ^Renderer, scaleX, scaleY: f32) -> bool ---
GetRenderScale :: proc(renderer: ^Renderer, scaleX, scaleY: ^f32) -> bool ---
@@ -203,9 +203,9 @@ foreign lib {
RenderPoints :: proc(renderer: ^Renderer, points: [^]FPoint, count: c.int) -> bool ---
RenderLine :: proc(renderer: ^Renderer, x1, y1, x2, y2: f32) -> bool ---
RenderLines :: proc(renderer: ^Renderer, points: [^]FPoint, count: c.int) -> bool ---
RenderRect :: proc(renderer: ^Renderer, #by_ptr rect: FRect) -> bool ---
RenderRect :: proc(renderer: ^Renderer, rect: Maybe(^FRect)) -> bool ---
RenderRects :: proc(renderer: ^Renderer, rects: [^]FRect, count: c.int) -> bool ---
RenderFillRect :: proc(renderer: ^Renderer, #by_ptr rect: FRect) -> bool ---
RenderFillRect :: proc(renderer: ^Renderer, rect: Maybe(^FRect)) -> bool ---
RenderFillRects :: proc(renderer: ^Renderer, rects: [^]FRect, count: c.int) -> bool ---
RenderTexture :: proc(renderer: ^Renderer, texture: ^Texture, srcrect, dstrect: Maybe(^FRect)) -> bool ---
RenderTextureRotated :: proc(renderer: ^Renderer, texture: ^Texture, srcrect, dstrect: Maybe(^FRect), angle: f64, #by_ptr center: FPoint, flip: FlipMode) -> bool ---

View File

@@ -78,7 +78,7 @@ foreign lib {
GetSurfaceAlphaMod :: proc(surface: ^Surface, alpha: ^Uint8) -> bool ---
SetSurfaceBlendMode :: proc(surface: ^Surface, blendMode: BlendMode) -> bool ---
GetSurfaceBlendMode :: proc(surface: ^Surface, blendMode: ^BlendMode) -> bool ---
SetSurfaceClipRect :: proc(surface: ^Surface, #by_ptr rect: Rect) -> bool ---
SetSurfaceClipRect :: proc(surface: ^Surface, rect: Maybe(^Rect)) -> bool ---
GetSurfaceClipRect :: proc(surface: ^Surface, rect: ^Rect) -> bool ---
FlipSurface :: proc(surface: ^Surface, flip: FlipMode) -> bool ---
DuplicateSurface :: proc(surface: ^Surface) -> ^Surface ---
@@ -90,15 +90,15 @@ foreign lib {
PremultiplyAlpha :: proc(width, height: c.int, src_format: PixelFormat, src: rawptr, src_pitch: c.int, dst_format: PixelFormat, dst: rawptr, dst_pitch: c.int, linear: bool) -> bool ---
PremultiplySurfaceAlpha :: proc(surface: ^Surface, linear: bool) -> bool ---
ClearSurface :: proc(surface: ^Surface, r, g, b, a: f32) -> bool ---
FillSurfaceRect :: proc(dst: ^Surface, #by_ptr rect: Rect, color: Uint32) -> bool ---
FillSurfaceRect :: proc(dst: ^Surface, rect: Maybe(^Rect), color: Uint32) -> bool ---
FillSurfaceRects :: proc(dst: ^Surface, rects: [^]Rect, count: c.int, color: Uint32) -> bool ---
BlitSurface :: proc(src: ^Surface, #by_ptr srcrect: Rect, dst: ^Surface, #by_ptr dstrect: Rect) -> bool ---
BlitSurfaceUnchecked :: proc(src: ^Surface, #by_ptr srcrect: Rect, dst: ^Surface, #by_ptr dstrect: Rect) -> bool ---
BlitSurfaceScaled :: proc(src: ^Surface, #by_ptr srcrect: Rect, dst: ^Surface, #by_ptr dstrect: Rect, scaleMode: ScaleMode) -> bool ---
BlitSurfaceUncheckedScaled :: proc(src: ^Surface, #by_ptr srcrect: Rect, dst: ^Surface, #by_ptr dstrect: Rect, scaleMode: ScaleMode) -> bool ---
BlitSurfaceTiled :: proc(src: ^Surface, #by_ptr srcrect: Rect, dst: ^Surface, #by_ptr dstrect: Rect) -> bool ---
BlitSurfaceTiledWithScale :: proc(src: ^Surface, #by_ptr srcrect: Rect, scale: f32, scaleMode: ScaleMode, dst: ^Surface, #by_ptr dstrect: Rect) -> bool ---
BlitSurface9Grid :: proc(src: ^Surface, #by_ptr srcrect: Rect, left_width, right_width, top_height, bottom_height: c.int, scale: f32, scaleMode: ScaleMode, dst: ^Surface, #by_ptr dstrect: Rect) -> bool ---
BlitSurface :: proc(src: ^Surface, srcrect: Maybe(^Rect), dst: ^Surface, dstrect: Maybe(^Rect)) -> bool ---
BlitSurfaceUnchecked :: proc(src: ^Surface, srcrect: Maybe(^Rect), dst: ^Surface, dstrect: Maybe(^Rect)) -> bool ---
BlitSurfaceScaled :: proc(src: ^Surface, srcrect: Maybe(^Rect), dst: ^Surface, dstrect: Maybe(^Rect), scaleMode: ScaleMode) -> bool ---
BlitSurfaceUncheckedScaled :: proc(src: ^Surface, srcrect: Maybe(^Rect), dst: ^Surface, dstrect: Maybe(^Rect), scaleMode: ScaleMode) -> bool ---
BlitSurfaceTiled :: proc(src: ^Surface, srcrect: Maybe(^Rect), dst: ^Surface, dstrect: Maybe(^Rect)) -> bool ---
BlitSurfaceTiledWithScale :: proc(src: ^Surface, srcrect: Maybe(^Rect), scale: f32, scaleMode: ScaleMode, dst: ^Surface, dstrect: Maybe(^Rect)) -> bool ---
BlitSurface9Grid :: proc(src: ^Surface, srcrect: Maybe(^Rect), left_width, right_width, top_height, bottom_height: c.int, scale: f32, scaleMode: ScaleMode, dst: ^Surface, dstrect: Maybe(^Rect)) -> bool ---
MapSurfaceRGB :: proc(surface: ^Surface, r, g, b: Uint8) -> Uint32 ---
MapSurfaceRGBA :: proc(surface: ^Surface, r, g, b, a: Uint8) -> Uint32 ---
ReadSurfacePixel :: proc(surface: ^Surface, x, y: c.int, r, g, b, a: ^Uint8) -> bool ---