Skip to content

vendor:sdl3: Add missing bindings and fix some issues#6108

Open
VoidStarCaster wants to merge 18 commits intoodin-lang:masterfrom
VoidStarCaster:sdl3-fix
Open

vendor:sdl3: Add missing bindings and fix some issues#6108
VoidStarCaster wants to merge 18 commits intoodin-lang:masterfrom
VoidStarCaster:sdl3-fix

Conversation

@VoidStarCaster
Copy link

This PR fixes several issues with vendor:sdl3 that I opened (#6092, #6098 and #6102).
I also did a pass on most files and fixed other issues (wrong types or #by_ptr where pointer can be nil), typos, added missing bindings and constants, and added #force_inline for several macros.

GetRectIntersection :: proc(#by_ptr A, B: Rect, result: ^Rect) -> bool ---
GetRectUnion :: proc(#by_ptr A, B: Rect, result: ^Rect) -> bool ---
GetRectEnclosingPoints :: proc(points: [^]Point, count: c.int, #by_ptr clip: Rect, result: ^Rect) -> bool ---
GetRectEnclosingPoints :: proc(points: [^]Point, count: c.int, clip: ^Rect, result: ^Rect) -> bool ---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make Maybe(^Rect)?

GetRectIntersectionFloat :: proc(#by_ptr A, B: FRect, result: ^FRect) -> bool ---
GetRectUnionFloat :: proc(#by_ptr A, B: FRect, result: ^FRect) -> bool ---
GetRectEnclosingPointsFloat :: proc(points: [^]FPoint, count: c.int, #by_ptr clip: FRect, result: ^FRect) -> bool ---
GetRectEnclosingPointsFloat :: proc(points: [^]FPoint, count: c.int, clip: ^FRect, result: ^FRect) -> bool ---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make Maybe(^FRect)?

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 ---
RenderTextureRotated :: proc(renderer: ^Renderer, texture: ^Texture, srcrect, dstrect: Maybe(^FRect), angle: f64, center: ^FPoint, flip: FlipMode) -> bool ---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make Maybe(^FPoint)?

GetWindowPixelDensity :: proc(window: ^Window) -> f32 ---
GetWindowDisplayScale :: proc(window: ^Window) -> f32 ---
SetWindowFullscreenMode :: proc(window: ^Window, #by_ptr mode: DisplayMode) -> bool ---
SetWindowFullscreenMode :: proc(window: ^Window, mode: ^DisplayMode) -> bool ---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Maybe(^DisplayMode)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uses of Maybe(^T) in SDL bindings are pretty inconsistent, some functions have it, some are missing it (for example GetRenderLogicalPresentationRect could have it for rect and RenderGeometry could have it for indices), so I just defaulted to ^T. Should it be used on any parameter that can be nil ?

@VoidStarCaster
Copy link
Author

I fixed the misuse of tab for alignment and fixed a missing pointer in a GetJoystickPowerInfo parameter.
As I was saying here, the use of Maybe() in the bindings are inconsistent, so I also did a pass and added it to every parameters that can be nil. Only exceptions are functions like DestroySurface that do nothing if the parameter is nil.
If it's too much of a change, I can revert it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants