hedgewars/uStore.pas
changeset 15687 63e2b7b2ec47
parent 15604 6a38a30e772a
parent 15685 d92eeb468dad
child 15775 72f735c03fec
equal deleted inserted replaced
15684:41121e2f5c03 15687:63e2b7b2ec47
    31 procedure StoreRelease(reload: boolean);
    31 procedure StoreRelease(reload: boolean);
    32 procedure RenderHealth(var Hedgehog: THedgehog);
    32 procedure RenderHealth(var Hedgehog: THedgehog);
    33 function makeHealthBarTexture(w, h, Color: Longword): PTexture;
    33 function makeHealthBarTexture(w, h, Color: Longword): PTexture;
    34 procedure AddProgress;
    34 procedure AddProgress;
    35 procedure FinishProgress;
    35 procedure FinishProgress;
       
    36 procedure LoadFont(font: THWFont);
    36 function  LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    37 function  LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    37 
    38 
    38 // loads an image from the games data files
    39 // loads an image from the games data files
    39 function  LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    40 function  LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    40 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path
    41 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path
   360             GraveTex:= Surface2Tex(texsurf, false);
   361             GraveTex:= Surface2Tex(texsurf, false);
   361             SDL_FreeSurface(texsurf)
   362             SDL_FreeSurface(texsurf)
   362             end
   363             end
   363 end;
   364 end;
   364 
   365 
       
   366 procedure LoadFont(font: THWFont);
       
   367 var s: shortstring;
       
   368 begin
       
   369     with Fontz[font] do
       
   370         begin
       
   371         if Handle <> nil then
       
   372             begin
       
   373             TTF_CloseFont(Handle);
       
   374             Handle:= nil;
       
   375             end;
       
   376         s:= cPathz[ptFonts] + '/' + Name;
       
   377         WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
       
   378         Handle:= TTF_OpenFontRW(rwopsOpenRead(s), true, Height);
       
   379         if SDLCheck(Handle <> nil, 'TTF_OpenFontRW', true) then exit;
       
   380         TTF_SetFontStyle(Handle, style);
       
   381         WriteLnToConsole(msgOK)
       
   382         end;
       
   383 end;
       
   384 
   365 procedure LoadFonts();
   385 procedure LoadFonts();
   366 var s: shortstring;
   386 var fi: THWFont;
   367     fi: THWFont;
       
   368 begin
   387 begin
   369 AddFileLog('LoadFonts();');
   388 AddFileLog('LoadFonts();');
   370 
   389 
   371 if (not cOnlyStats) then
   390 if (not cOnlyStats) then
   372     for fi:= Low(THWFont) to High(THWFont) do
   391     for fi:= Low(THWFont) to High(THWFont) do
   373         with Fontz[fi] do
   392         begin
   374             begin
   393         LoadFont(fi);
   375             s:= cPathz[ptFonts] + '/' + Name;
   394         end;
   376             WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
       
   377             Handle:= TTF_OpenFontRW(rwopsOpenRead(s), true, Height);
       
   378             if SDLCheck(Handle <> nil, 'TTF_OpenFontRW', true) then exit;
       
   379             TTF_SetFontStyle(Handle, style);
       
   380             WriteLnToConsole(msgOK)
       
   381             end;
       
   382 end;
   395 end;
   383 
   396 
   384 procedure StoreLoad(reload: boolean);
   397 procedure StoreLoad(reload: boolean);
   385 var ii: TSprite;
   398 var ii: TSprite;
   386     ai: TAmmoType;
   399     ai: TAmmoType;