Skip to content

Commit a5733d1

Browse files
ADD: Hint as requested
1 parent 4f4a452 commit a5733d1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

units/sdl2.pas

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@
6767
statically linked into the project. After that you need to call the
6868
SDL_LoadLib function by your application before using any SDL2 library calls.
6969
70+
"WARNING: This is an experimental feature! Many functions are not prepared to be
71+
loaded at runtime, check beforehand if a function is translated already.
72+
You can help adding functions by simply replacing
73+
74+
{ --- describing comment ---}
75+
function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF};
76+
77+
by
78+
79+
type
80+
TSDL_CreateWindowAndRenderer_func = function(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32; cdecl;
81+
var
82+
{ --- describing comment ---}
83+
SDL_CreateWindowAndRenderer: TSDL_CreateWindowAndRenderer_func = nil;
84+
85+
And you need to register the function in sdl_runtime_linking.inc by uncommenting
86+
(or adding if not already in the list). For this example I must add:
87+
88+
SDL_CreateWindowAndRenderer := TSDL_CreateWindowAndRenderer_func(GetProcAddress(LibHandle, 'SDL_CreateWindowAndRenderer'));
89+
if not Assigned(SDL_CreateWindowAndRenderer) then Result := False;"
7090
}
7191
//{$DEFINE SDL_RUNTIME_LOADING}
7292

0 commit comments

Comments
 (0)