Split-up require_results foreign blocks

This commit is contained in:
gingerBill
2025-02-05 10:41:45 +00:00
parent 83542a3f04
commit 898bea8a97
6 changed files with 39 additions and 25 deletions

View File

@@ -49,7 +49,7 @@ EnumerationResult :: enum c.int {
EnumerateDirectoryCallback :: #type proc "c" (userdata: rawptr, dirname, fname: cstring) -> EnumerationResult
@(default_calling_convention="c", link_prefix="SDL_")
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
GetBasePath :: proc() -> cstring ---
GetPrefPath :: proc(org, app: cstring) -> [^]c.char ---

View File

@@ -117,10 +117,10 @@ HAT_UP :: 0x01
HAT_RIGHT :: 0x02
HAT_DOWN :: 0x04
HAT_LEFT :: 0x08
HAT_RIGHTUP :: (HAT_RIGHT|HAT_UP)
HAT_RIGHTDOWN :: (HAT_RIGHT|HAT_DOWN)
HAT_LEFTUP :: (HAT_LEFT|HAT_UP)
HAT_LEFTDOWN :: (HAT_LEFT|HAT_DOWN)
HAT_RIGHTUP :: HAT_RIGHT|HAT_UP
HAT_RIGHTDOWN :: HAT_RIGHT|HAT_DOWN
HAT_LEFTUP :: HAT_LEFT|HAT_UP
HAT_LEFTDOWN :: HAT_LEFT|HAT_DOWN
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {

View File

@@ -132,7 +132,6 @@ DEBUG_TEXT_FONT_CHARACTER_SIZE :: 8
foreign lib {
GetNumRenderDrivers :: proc() -> c.int ---
GetRenderDriver :: proc(index: c.int) -> cstring ---
CreateWindowAndRenderer :: proc(title: cstring, width, height: c.int, window_flags: WindowFlags, window: ^^Window, renderer: ^^Renderer) -> bool ---
CreateRenderer :: proc(window: ^Window, name: cstring) -> ^Renderer ---
CreateRendererWithProperties :: proc(props: PropertiesID) -> ^Renderer ---
CreateSoftwareRenderer :: proc(surface: ^Surface) -> ^Renderer ---
@@ -140,13 +139,24 @@ foreign lib {
GetRenderWindow :: proc(renderer: ^Renderer) -> ^Window ---
GetRendererName :: proc(renderer: ^Renderer) -> cstring ---
GetRendererProperties :: proc(renderer: ^Renderer) -> PropertiesID ---
GetRenderOutputSize :: proc(renderer: ^Renderer, w, h: ^c.int) -> bool ---
GetCurrentRenderOutputSize :: proc(renderer: ^Renderer, w, h: ^c.int) -> bool ---
CreateTexture :: proc(renderer: ^Renderer, format: PixelFormat, access: TextureAccess, w, h: c.int) -> ^Texture ---
CreateTextureFromSurface :: proc(renderer: ^Renderer, surface: ^Surface) -> ^Texture ---
CreateTextureWithProperties :: proc(renderer: ^Renderer, props: PropertiesID) -> ^Texture ---
GetTextureProperties :: proc(texture: ^Texture) -> PropertiesID ---
GetRendererFromTexture :: proc(texture: ^Texture) -> ^Renderer ---
GetRenderTarget :: proc(renderer: ^Renderer) -> ^Texture ---
RenderViewportSet :: proc(renderer: ^Renderer) -> bool ---
RenderClipEnabled :: proc(renderer: ^Renderer) -> bool ---
RenderReadPixels :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> ^Surface ---
GetRenderMetalLayer :: proc(renderer: ^Renderer) -> rawptr ---
GetRenderMetalCommandEncoder :: proc(renderer: ^Renderer) -> rawptr ---
}
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
CreateWindowAndRenderer :: proc(title: cstring, width, height: c.int, window_flags: WindowFlags, window: ^^Window, renderer: ^^Renderer) -> bool ---
GetRenderOutputSize :: proc(renderer: ^Renderer, w, h: ^c.int) -> bool ---
GetCurrentRenderOutputSize :: proc(renderer: ^Renderer, w, h: ^c.int) -> bool ---
GetTextureSize :: proc(texture: ^Texture, w, h: ^f32) -> bool ---
SetTextureColorMod :: proc(texture: ^Texture, r, g, b: Uint8) -> bool ---
SetTextureColorModFloat :: proc(texture: ^Texture, r, g, b: f32) -> bool ---
@@ -167,7 +177,6 @@ foreign lib {
LockTextureToSurface :: proc(texture: ^Texture, #by_ptr rect: Rect, surface: ^^Surface) -> bool ---
UnlockTexture :: proc(texture: ^Texture) ---
SetRenderTarget :: proc(renderer: ^Renderer, texture: ^Texture) -> bool ---
GetRenderTarget :: proc(renderer: ^Renderer) -> ^Texture ---
SetRenderLogicalPresentation :: proc(renderer: ^Renderer, w, h: c.int, mode: RendererLogicalPresentation) -> bool ---
GetRenderLogicalPresentation :: proc(renderer: ^Renderer, w, h: ^c.int, mode: ^RendererLogicalPresentation) -> bool ---
GetRenderLogicalPresentationRect :: proc(renderer: ^Renderer, rect: ^FRect) -> bool ---
@@ -176,11 +185,9 @@ foreign lib {
ConvertEventToRenderCoordinates :: proc(renderer: ^Renderer, event: ^Event) -> bool ---
SetRenderViewport :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> bool ---
GetRenderViewport :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
RenderViewportSet :: proc(renderer: ^Renderer) -> bool ---
GetRenderSafeArea :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
SetRenderClipRect :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> bool ---
GetRenderClipRect :: proc(renderer: ^Renderer, rect: ^Rect) -> bool ---
RenderClipEnabled :: proc(renderer: ^Renderer) -> bool ---
SetRenderScale :: proc(renderer: ^Renderer, scaleX, scaleY: f32) -> bool ---
GetRenderScale :: proc(renderer: ^Renderer, scaleX, scaleY: ^f32) -> bool ---
SetRenderDrawColor :: proc(renderer: ^Renderer, r, g, b, a: Uint8) -> bool ---
@@ -207,13 +214,10 @@ foreign lib {
RenderTexture9Grid :: proc(renderer: ^Renderer, texture: ^Texture, #by_ptr srcrect: FRect, left_width, right_width, top_height, bottom_height: f32, scale: f32, #by_ptr dstrect: FRect) -> bool ---
RenderGeometry :: proc(renderer: ^Renderer, texture: ^Texture, vertices: [^]Vertex, num_vertices: c.int, indices: [^]c.int, num_indices: c.int) -> bool ---
RenderGeometryRaw :: proc(renderer: ^Renderer, texture: ^Texture, xy: [^]f32, xy_stride: c.int, color: [^]FColor, color_stride: c.int, uv: [^]f32, uv_stride: c.int, num_vertices: c.int, indices: rawptr, num_indices: c.int, size_indices: c.int) -> bool ---
RenderReadPixels :: proc(renderer: ^Renderer, #by_ptr rect: Rect) -> ^Surface ---
RenderPresent :: proc(renderer: ^Renderer) -> bool ---
DestroyTexture :: proc(texture: ^Texture) ---
DestroyRenderer :: proc(renderer: ^Renderer) ---
FlushRenderer :: proc(renderer: ^Renderer) -> bool ---
GetRenderMetalLayer :: proc(renderer: ^Renderer) -> rawptr ---
GetRenderMetalCommandEncoder :: proc(renderer: ^Renderer) -> rawptr ---
AddVulkanRenderSemaphores :: proc(renderer: ^Renderer, wait_stage_mask: Uint32 , wait_semaphore, signal_semaphore: Sint64) -> bool ---
SetRenderVSync :: proc(renderer: ^Renderer, vsync: c.int) -> bool ---
GetRenderVSync :: proc(renderer: ^Renderer, vsync: ^c.int) -> bool ---

View File

@@ -19,7 +19,7 @@ SensorType :: enum c.int {
GYRO_R, /**< Gyroscope for right Joy-Con controller */
}
@(default_calling_convention="c", link_prefix="SDL_")
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
GetSensors :: proc(count: ^c.int) -> [^]SensorID ---
GetSensorNameForID :: proc(instance_id: SensorID) -> cstring ---

View File

@@ -48,7 +48,7 @@ StorageInterface :: struct {
Storage :: struct {}
@(default_calling_convention="c", link_prefix="SDL_")
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
OpenTitleStorage :: proc(override: cstring, props: PropertiesID) -> ^Storage ---
OpenUserStorage :: proc(org, app: cstring, props: PropertiesID) -> ^Storage ---
@@ -57,14 +57,20 @@ foreign lib {
CloseStorage :: proc(storage: ^Storage) -> bool ---
StorageReady :: proc(storage: ^Storage) -> bool ---
GetStorageFileSize :: proc(storage: ^Storage, path: cstring, length: ^Uint64) -> bool ---
CreateStorageDirectory :: proc(storage: ^Storage, path: cstring) -> bool ---
GetStorageSpaceRemaining :: proc(storage: ^Storage) -> Uint64 ---
GlobStorageDirectory :: proc(storage: ^Storage, path: cstring, pattern: cstring, flags: GlobFlags, count: ^c.int) -> [^][^]c.char ---
}
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
ReadStorageFile :: proc(storage: ^Storage, path: cstring, destination: rawptr, length: Uint64) -> bool ---
WriteStorageFile :: proc(storage: ^Storage, path: cstring, source: rawptr, length: Uint64) -> bool ---
CreateStorageDirectory :: proc(storage: ^Storage, path: cstring) -> bool ---
EnumerateStorageDirectory :: proc(storage: ^Storage, path: cstring, callback: EnumerateDirectoryCallback, userdata: rawptr) -> bool ---
RemoveStoragePath :: proc(storage: ^Storage, path: cstring) -> bool ---
RenameStoragePath :: proc(storage: ^Storage, oldpath, newpath: cstring) -> bool ---
CopyStorageFile :: proc(storage: ^Storage, oldpath, newpath: cstring) -> bool ---
GetStoragePathInfo :: proc(storage: ^Storage, path: cstring, info: ^PathInfo) -> bool ---
GetStorageSpaceRemaining :: proc(storage: ^Storage) -> Uint64 ---
GlobStorageDirectory :: proc(storage: ^Storage, path: cstring, pattern: cstring, flags: GlobFlags, count: ^c.int) -> [^][^]c.char ---
}
}

View File

@@ -75,16 +75,20 @@ EndThreadFunction :: proc "c" () -> FunctionPointer {
}
}
@(default_calling_convention="c", link_prefix="SDL_")
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
GetThreadName :: proc(thread: ^Thread) -> cstring ---
GetCurrentThreadID :: proc() -> ThreadID ---
GetThreadID :: proc(thread: ^Thread) -> ThreadID ---
SetCurrentThreadPriority :: proc(priority: ThreadPriority) -> bool ---
WaitThread :: proc(thread: ^Thread, status: ^c.int) ---
GetThreadState :: proc(thread: ^Thread) -> ThreadState ---
DetachThread :: proc(thread: ^Thread) ---
GetTLS :: proc(id: ^TLSID) -> rawptr ---
SetTLS :: proc(id: ^TLSID, value: rawptr, destructor: TLSDestructorCallback) -> bool ---
CleanupTLS :: proc() ---
}
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
SetCurrentThreadPriority :: proc(priority: ThreadPriority) -> bool ---
WaitThread :: proc(thread: ^Thread, status: ^c.int) ---
DetachThread :: proc(thread: ^Thread) ---
CleanupTLS :: proc() ---
}