set engine window icon in sdl2 sdl2transition
authorsheepluva
Fri, 13 Nov 2015 23:46:19 +0100
branchsdl2transition
changeset 11373 011c5cc195cc
parent 11372 208bc571f949
child 11374 28c309f45269
set engine window icon in sdl2
hedgewars/SDLh.pas
hedgewars/uStore.pas
--- a/hedgewars/SDLh.pas	Fri Nov 13 22:35:26 2015 +0100
+++ b/hedgewars/SDLh.pas	Fri Nov 13 23:46:19 2015 +0100
@@ -1063,6 +1063,8 @@
 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
 
 function  SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName;
+procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; external SDLLibName;
+
 function  SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName;
 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
--- a/hedgewars/uStore.pas	Fri Nov 13 22:35:26 2015 +0100
+++ b/hedgewars/uStore.pas	Fri Nov 13 23:46:19 2015 +0100
@@ -1084,6 +1084,15 @@
         SDLwindow:= SDL_CreateWindow(PChar('Hedgewars'), x, y, cScreenWidth, cScreenHeight, flags);
     SDLTry(SDLwindow <> nil, 'SDL_CreateWindow', true);
 
+    // load engine ico
+    {$IFNDEF DARWIN}
+    ico:= LoadDataImage(ptGraphics, 'hwengine', ifIgnoreCaps);
+    if ico <> nil then
+        begin
+        SDL_SetWindowIcon(SDLwindow, ico);
+        SDL_FreeSurface(ico);
+        end;
+    {$ENDIF}
     SetupOpenGL();
 
     if reinit then