hedgewars/uWorld.pas
changeset 298 112e61bd2cc2
parent 295 8834f3cb620e
child 308 806c3b55500d
equal deleted inserted replaced
297:279e10ec31b4 298:112e61bd2cc2
    51                    end;
    51                    end;
    52 
    52 
    53 var cWaterSprCount: integer;
    53 var cWaterSprCount: integer;
    54     Captions: array[TCapGroup] of TCaptionStr;
    54     Captions: array[TCapGroup] of TCaptionStr;
    55     AMxLeft, AMxCurr, SlotsNum: integer;
    55     AMxLeft, AMxCurr, SlotsNum: integer;
       
    56     fpsSurface: PSDL_Surface;
    56 
    57 
    57 procedure InitWorld;
    58 procedure InitWorld;
    58 begin
    59 begin
    59 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
    60 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
    60 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
    61 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
   336 {$ENDIF}
   337 {$ENDIF}
   337 
   338 
   338 if isPaused then DrawCentered(cScreenWidth div 2, cScreenHeight div 2, PauseSurface, Surface);
   339 if isPaused then DrawCentered(cScreenWidth div 2, cScreenHeight div 2, PauseSurface, Surface);
   339 
   340 
   340 inc(Frames);
   341 inc(Frames);
   341 inc(CountTicks, Lag);
   342 if cShowFPS then
   342 if CountTicks >= 1000 then
   343    begin
   343    begin
   344    inc(CountTicks, Lag);
   344    FPS:= Frames;
   345    if CountTicks >= 1000 then
   345    Frames:= 0;
   346       begin
   346    CountTicks:= 0;
   347       FPS:= Frames;
   347    end;
   348       Frames:= 0;
   348 if cShowFPS then DXOutText(cScreenWidth - 50, 10, fnt16, inttostr(FPS) + ' fps', Surface);
   349       CountTicks:= 0;
       
   350       s:= inttostr(FPS) + ' fps';
       
   351       if fpsSurface <> nil then SDL_FreeSurface(fpsSurface);
       
   352       fpsSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, PChar(String(s)), $FFFFFF);
       
   353       end;
       
   354    r.x:= cScreenWidth - 50;
       
   355    r.y:= 10;
       
   356    SDL_UpperBlit(fpsSurface, nil, Surface, @r)
       
   357    end;
   349 
   358 
   350 inc(SoundTimerTicks, Lag);
   359 inc(SoundTimerTicks, Lag);
   351 if SoundTimerTicks >= 50 then
   360 if SoundTimerTicks >= 50 then
   352    begin
   361    begin
   353    SoundTimerTicks:= 0;
   362    SoundTimerTicks:= 0;