hedgewars/uWorld.pas
changeset 2850 f6f8db825ce7
parent 2839 95977f876122
child 2851 a9a5ce1d9f23
equal deleted inserted replaced
2849:5e9325659be2 2850:f6f8db825ce7
    61 var cWaveWidth, cWaveHeight: LongInt;
    61 var cWaveWidth, cWaveHeight: LongInt;
    62     Captions: array[TCapGroup] of TCaptionStr;
    62     Captions: array[TCapGroup] of TCaptionStr;
    63     AMxShift, SlotsNum: LongInt;
    63     AMxShift, SlotsNum: LongInt;
    64     tmpSurface: PSDL_Surface;
    64     tmpSurface: PSDL_Surface;
    65     fpsTexture: PTexture;
    65     fpsTexture: PTexture;
       
    66     timeTexture: PTexture;
    66     FPS: Longword;
    67     FPS: Longword;
    67     CountTicks: Longword;
    68     CountTicks: Longword;
    68     SoundTimerTicks: Longword;
    69     SoundTimerTicks: Longword;
    69     prevPoint: TPoint;
    70     prevPoint: TPoint;
    70 	amSel: TAmmoType = amNothing;
    71 	amSel: TAmmoType = amNothing;
   648 offset:= 300;
   649 offset:= 300;
   649 {$ELSE}
   650 {$ELSE}
   650 offset:= 10;
   651 offset:= 10;
   651 {$ENDIF}
   652 {$ENDIF}
   652 inc(Frames);
   653 inc(Frames);
       
   654 
       
   655 if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag);
       
   656 if (GameType = gmtDemo) and (not isSpeed) and (CountTicks >= 1000) then
       
   657    begin
       
   658    i:=GameTicks div 60000;
       
   659    t:=(GameTicks-(i*60000)) div 1000;
       
   660    s:='';
       
   661    if i<10 then s:='0';
       
   662    s:= s+inttostr(i)+':';
       
   663    if t<10 then s:=s+'0';
       
   664    s:= s+inttostr(t);
       
   665    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
       
   666    tmpSurface:= doSurfaceConversion(tmpSurface);
       
   667    timeTexture:= Surface2Tex(tmpSurface, false);
       
   668    SDL_FreeSurface(tmpSurface)
       
   669    end;
       
   670 
       
   671 if timeTexture <> nil then
       
   672    DrawTexture((cScreenWidth shr 1) - 10 - timeTexture^.w, offset + timeTexture^.h+5, timeTexture);
       
   673 
   653 if cShowFPS then
   674 if cShowFPS then
   654    begin
   675    begin
   655    inc(CountTicks, Lag);
       
   656    if CountTicks >= 1000 then
   676    if CountTicks >= 1000 then
   657       begin
   677       begin
   658       FPS:= Frames;
   678       FPS:= Frames;
   659       Frames:= 0;
   679       Frames:= 0;
   660       CountTicks:= 0;
   680       CountTicks:= 0;
   666       SDL_FreeSurface(tmpSurface)
   686       SDL_FreeSurface(tmpSurface)
   667       end;
   687       end;
   668    if fpsTexture <> nil then
   688    if fpsTexture <> nil then
   669       DrawTexture((cScreenWidth shr 1) - 50, offset, fpsTexture);
   689       DrawTexture((cScreenWidth shr 1) - 50, offset, fpsTexture);
   670    end;
   690    end;
       
   691 
       
   692 if CountTicks >= 1000 then CountTicks:= 0;
   671 
   693 
   672 // lag warning (?)
   694 // lag warning (?)
   673 inc(SoundTimerTicks, Lag);
   695 inc(SoundTimerTicks, Lag);
   674 if SoundTimerTicks >= 50 then
   696 if SoundTimerTicks >= 50 then
   675    begin
   697    begin