Skip to content

Commit

Permalink
Add SDL.SetRenderTarget binding (#45)
Browse files Browse the repository at this point in the history
* add SDL.SetRenderTarget binding

* properly use codegen for SetRenderTarget binding
  • Loading branch information
mattjennings authored Jan 11, 2025
1 parent fe02379 commit ba1ff69
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SDL/_symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,13 @@ export const symbols = {
],
result: /* int */ "i32",
},
SDL_SetRenderTarget: {
parameters: [
/* SDL_Renderer* renderer */ "pointer",
/* SDL_Texture* texture */ "pointer",
],
result: /* int */ "i32",
},
SDL_SetSurfaceBlendMode: {
parameters: [
/* SDL_Surface* surface */ "pointer",
Expand Down
15 changes: 15 additions & 0 deletions src/SDL/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,21 @@ export function SetRenderDrawColor(
}
SetRenderDrawColor.symbolName = "SDL_SetRenderDrawColor";

export function SetRenderTarget(
renderer: Pointer<Renderer>,
texture: Pointer<Texture> | null,
): int {
const _result = _library.symbols.SDL_SetRenderTarget(
Platform.toPlatformPointer(renderer),
Platform.toPlatformPointer(texture),
) as int;
if (_result < 0) {
throw new SDLError(GetError());
}
return _result;
}
SetRenderTarget.symbolName = "SDL_SetRenderTarget";

export function SetSurfaceBlendMode(
surface: PointerLike<Surface>,
blendMode: BlendMode,
Expand Down
15 changes: 15 additions & 0 deletions tools/codegen/SDL/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,21 @@ export const functions: CodeGenFunctions = {
},
checkForError: true,
},
SDL_SetRenderTarget: {
parameters: {
renderer: {
type: "SDL_Renderer*",
},
texture: {
type: "SDL_Texture*",
isNullable: true
},
},
result: {
type: "int",
},
checkForError: true,
},
SDL_SetSurfaceBlendMode: {
parameters: {
surface: {
Expand Down

0 comments on commit ba1ff69

Please sign in to comment.