avoid linking compatible code from sdl library, let's provide our own
authorkoda
Sat, 05 Nov 2011 01:25:11 +0100
changeset 6281 dc9c44f47e75
parent 6280 3725cfec4542
child 6282 de449b2d9607
avoid linking compatible code from sdl library, let's provide our own
hedgewars/SDLh.pas
--- a/hedgewars/SDLh.pas	Fri Nov 04 19:00:41 2011 -0400
+++ b/hedgewars/SDLh.pas	Sat Nov 05 01:25:11 2011 +0100
@@ -735,10 +735,6 @@
 function  SDL_InitSubSystem(flags: LongWord): LongInt; cdecl; external SDLLibName;
 procedure SDL_Quit; cdecl; external SDLLibName;
 
-function  SDL_VideoDriverName(var namebuf; maxlen: LongInt): PChar; cdecl; external SDLLibName;
-function  SDL_EnableUNICODE(enable: LongInt): LongInt; cdecl; external SDLLibName;
-function  SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt; cdecl; external SDLLibName;
-
 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
 
@@ -778,6 +774,7 @@
 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
+function  SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName;
 
 function  SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName;
 procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName;
@@ -803,6 +800,7 @@
 
 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName;
+procedure SDL_StartTextInput; cdecl; external SDLLibName;
 
 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongInt): LongInt; cdecl; external SDLLibName;
 {$ELSE}
@@ -858,6 +856,9 @@
 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
 function  SDL_AllocFormat(format: Longword): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
+function  SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
+function  SDL_EnableUNICODE(enable: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
+function  SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
 
 (*  SDL_ttf  *)
 function  TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
@@ -935,7 +936,7 @@
 function  SDLNet_Read32(buf: pointer): LongWord;
 
 implementation
-uses uVariables;
+uses strings, uVariables;
 
 {$IFDEF SDL13}
 // this needs to be reimplemented because in SDL_compat.c the window is the one created in the SDL_SetVideoMode
@@ -944,6 +945,29 @@
 begin
     SDL_WarpMouseInWindow(SDLwindow, x, y);
 end;
+
+function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar;
+var name : PChar = nil;
+begin
+    name:= SDL_GetCurrentVideoDriver();
+    if (name <> nil) and (namebuf <> nil) then
+        begin
+        strlcopy(namebuf, name, maxlen);
+        exit(namebuf)
+        end;
+    exit(name);
+end;
+
+function SDL_EnableUNICODE(enable: LongInt): LongInt;
+begin
+    SDL_StartTextInput();
+    exit(0);
+end;
+
+function SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt;
+begin
+    exit(0);
+end;
 {$ELSE}
 function SDL_AllocFormat(format: Longword): PSDL_PixelFormat;
 const conversionFormat: TSDL_PixelFormat = (