hedgewars/uWorld.pas
changeset 759 8da05b316d81
parent 757 ddbff94153e8
child 760 23aaafa40b4e
equal deleted inserted replaced
758:bebfae2063b3 759:8da05b316d81
    50                    end;
    50                    end;
    51 
    51 
    52 var cWaterSprCount: LongInt;
    52 var cWaterSprCount: LongInt;
    53     Captions: array[TCapGroup] of TCaptionStr;
    53     Captions: array[TCapGroup] of TCaptionStr;
    54     AMxLeft, AMxCurr, SlotsNum: LongInt;
    54     AMxLeft, AMxCurr, SlotsNum: LongInt;
    55     fpsSurface: PSDL_Surface;
    55     tmpSurface: PSDL_Surface;
       
    56     fpsTexture: PTexture = nil;
    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);
   359       begin
   360       begin
   360       FPS:= Frames;
   361       FPS:= Frames;
   361       Frames:= 0;
   362       Frames:= 0;
   362       CountTicks:= 0;
   363       CountTicks:= 0;
   363       s:= inttostr(FPS) + ' fps';
   364       s:= inttostr(FPS) + ' fps';
   364       if fpsSurface <> nil then SDL_FreeSurface(fpsSurface);
   365       if fpsTexture <> nil then FreeTexture(fpsTexture);
   365       fpsSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF);
   366       tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF);
   366       end;
   367       fpsTexture:= Surface2Tex(tmpSurface);
   367    r.x:= cScreenWidth - 50;
   368       SDL_FreeSurface(tmpSurface)
   368    r.y:= 10;
   369       end;
   369 //   SDL_UpperBlit(fpsSurface, nil, Surface, @r)
   370    if fpsTexture <> nil then
       
   371       begin
       
   372       r.x:= 0;
       
   373       r.y:= 0;
       
   374       r.w:= fpsTexture^.w;
       
   375       r.h:= fpsTexture^.h;
       
   376       DrawFromRect(cScreenWidth - 50, 10, @r, fpsTexture, Surface);
       
   377       end
       
   378 //  SDL_UpperBlit(fpsSurface, nil, Surface, @r)
   370    end;
   379    end;
   371 
   380 
   372 inc(SoundTimerTicks, Lag);
   381 inc(SoundTimerTicks, Lag);
   373 if SoundTimerTicks >= 50 then
   382 if SoundTimerTicks >= 50 then
   374    begin
   383    begin