hedgewars/uStore.pas
changeset 4398 36d7e4b6ca81
parent 4390 f219628ed666
child 4403 0dfe26f48ec1
equal deleted inserted replaced
4397:ab577db125c4 4398:36d7e4b6ca81
    37 procedure RenderWeaponTooltip(atype: TAmmoType);
    37 procedure RenderWeaponTooltip(atype: TAmmoType);
    38 procedure ShowWeaponTooltip(x, y: LongInt);
    38 procedure ShowWeaponTooltip(x, y: LongInt);
    39 procedure FreeWeaponTooltip;
    39 procedure FreeWeaponTooltip;
    40 
    40 
    41 implementation
    41 implementation
    42 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uIO, uRender, uRenderUtils;
    42 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uIO, uRender, uRenderUtils, uCommands;
    43 
    43 
    44 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    44 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    45 
    45 
    46 var MaxTextureSize: LongInt;
    46 var MaxTextureSize: LongInt;
    47     cGPUVendor: TGPUVendor;
    47     cGPUVendor: TGPUVendor;
   776     exit;
   776     exit;
   777 FreeTexture(WeaponTooltipTex);
   777 FreeTexture(WeaponTooltipTex);
   778 WeaponTooltipTex:= nil
   778 WeaponTooltipTex:= nil
   779 end;
   779 end;
   780 
   780 
       
   781 procedure chFullScr(var s: shortstring);
       
   782 var flags: Longword = 0;
       
   783     ico: PSDL_Surface;
       
   784 {$IFDEF DEBUGFILE}
       
   785     buf: array[byte] of char;
       
   786 {$ENDIF}
       
   787 begin
       
   788     s:= s; // avoid compiler hint
       
   789     if Length(s) = 0 then cFullScreen:= not cFullScreen
       
   790     else cFullScreen:= s = '1';
       
   791 
       
   792 {$IFDEF DEBUGFILE}
       
   793     buf[0]:= char(0); // avoid compiler hint
       
   794     AddFileLog('Prepare to change video parameters...');
       
   795 {$ENDIF}
       
   796 
       
   797     flags:= SDL_OPENGL;// or SDL_RESIZABLE;
       
   798 
       
   799     if cFullScreen then
       
   800         flags:= flags or SDL_FULLSCREEN;
       
   801 
       
   802 {$IFDEF SDL_IMAGE_NEWER}
       
   803     WriteToConsole('Init SDL_image... ');
       
   804     SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true);
       
   805     WriteLnToConsole(msgOK);
       
   806 {$ENDIF}
       
   807     // load engine icon
       
   808 {$IFDEF DARWIN}
       
   809     ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps);
       
   810 {$ELSE}
       
   811     ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps);
       
   812 {$ENDIF}
       
   813     if ico <> nil then
       
   814     begin
       
   815         SDL_WM_SetIcon(ico, 0);
       
   816         SDL_FreeSurface(ico)
       
   817     end;
       
   818 
       
   819     // set window caption
       
   820     SDL_WM_SetCaption('Hedgewars', nil);
       
   821 
       
   822     if SDLPrimSurface <> nil then
       
   823     begin
       
   824 {$IFDEF DEBUGFILE}
       
   825         AddFileLog('Freeing old primary surface...');
       
   826 {$ENDIF}
       
   827         SDL_FreeSurface(SDLPrimSurface);
       
   828         SDLPrimSurface:= nil;
       
   829     end;
       
   830 
       
   831 {$IFDEF SDL13}
       
   832     if SDLwindow = nil then
       
   833     begin
       
   834         SDLwindow:= SDL_CreateWindow('Hedgewars', 0, 0, cScreenWidth, cScreenHeight,
       
   835                         SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN
       
   836                         {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS{$ENDIF});
       
   837         SDL_CreateRenderer(SDLwindow, -1, 0);
       
   838     end;
       
   839 
       
   840     SDL_SetRenderDrawColor(0, 0, 0, 255);
       
   841     SDL_RenderFill(nil);
       
   842     SDL_RenderPresent();
       
   843 {$ELSE}
       
   844     SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
       
   845     SDLTry(SDLPrimSurface <> nil, true);
       
   846     PixelFormat:= SDLPrimSurface^.format;
       
   847 {$ENDIF}
       
   848 
       
   849 {$IFDEF DEBUGFILE}
       
   850     AddFileLog('Setting up OpenGL...');
       
   851     AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))));
       
   852 {$ENDIF}
       
   853     SetupOpenGL();
       
   854 end;
       
   855 
   781 procedure initModule;
   856 procedure initModule;
   782 begin
   857 begin
       
   858     RegisterVariable('fullscr', vtCommand, @chFullScr, true);
       
   859 
   783     PixelFormat:= nil;
   860     PixelFormat:= nil;
   784     SDLPrimSurface:= nil;
   861     SDLPrimSurface:= nil;
   785 
   862 
   786 {$IFNDEF IPHONEOS}
   863 {$IFNDEF IPHONEOS}
   787     rotationQt:= 0;
   864     rotationQt:= 0;