hedgewars/uWorld.pas
changeset 3516 a8c673657b79
parent 3513 f589230fa21b
child 3523 6592fbb969da
equal deleted inserted replaced
3510:23145a950eae 3516:a8c673657b79
   870    t:= i mod 60;
   870    t:= i mod 60;
   871    s:= inttostr(t) + ':' + s;
   871    s:= inttostr(t) + ':' + s;
   872    if t < 10 then s:= '0' + s;
   872    if t < 10 then s:= '0' + s;
   873    s:= inttostr(i div 60) + ':' + s;
   873    s:= inttostr(i div 60) + ':' + s;
   874    
   874    
   875    if timeTexture <> nil then FreeTexture(timeTexture);
   875    if timeTexture <> nil then
       
   876         FreeTexture(timeTexture);
       
   877     timeTexture:= nil;
       
   878     
   876    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   879    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   877    tmpSurface:= doSurfaceConversion(tmpSurface);
   880    tmpSurface:= doSurfaceConversion(tmpSurface);
   878    timeTexture:= Surface2Tex(tmpSurface, false);
   881    timeTexture:= Surface2Tex(tmpSurface, false);
   879    SDL_FreeSurface(tmpSurface)
   882    SDL_FreeSurface(tmpSurface)
   880    end;
   883    end;
   888       begin
   891       begin
   889       FPS:= Frames;
   892       FPS:= Frames;
   890       Frames:= 0;
   893       Frames:= 0;
   891       CountTicks:= 0;
   894       CountTicks:= 0;
   892       s:= inttostr(FPS) + ' fps';
   895       s:= inttostr(FPS) + ' fps';
   893       if fpsTexture <> nil then FreeTexture(fpsTexture);
   896       if fpsTexture <> nil then
       
   897         FreeTexture(fpsTexture);
       
   898     fpsTexture:= nil;
   894       tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   899       tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   895       tmpSurface:= doSurfaceConversion(tmpSurface);
   900       tmpSurface:= doSurfaceConversion(tmpSurface);
   896       fpsTexture:= Surface2Tex(tmpSurface, false);
   901       fpsTexture:= Surface2Tex(tmpSurface, false);
   897       SDL_FreeSurface(tmpSurface)
   902       SDL_FreeSurface(tmpSurface)
   898       end;
   903       end;
   979 end;
   984 end;
   980 
   985 
   981 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
   986 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
   982 begin
   987 begin
   983 //if Group in [capgrpGameState] then WriteLnToConsole(s);
   988 //if Group in [capgrpGameState] then WriteLnToConsole(s);
   984 if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex);
   989     if Captions[Group].Tex <> nil then 
   985 
   990         FreeTexture(Captions[Group].Tex);
   986 Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
   991     Captions[Group].Tex:= nil;
   987 
   992 
   988 case Group of
   993     Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
   989     capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200
   994 
       
   995     case Group of
       
   996         capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200
   990     else
   997     else
   991     Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3;
   998         Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3;
   992     end;
   999     end;
   993 end;
  1000 end;
   994 
  1001 
   995 procedure MoveCamera;
  1002 procedure MoveCamera;
   996 const PrevSentPointTime: LongWord = 0;
  1003 const PrevSentPointTime: LongWord = 0;
  1094 r.w:= 32;
  1101 r.w:= 32;
  1095 r.h:= 32;
  1102 r.h:= 32;
  1096 
  1103 
  1097 if time = 0 then time:= 5000;
  1104 if time = 0 then time:= 5000;
  1098 missionTimer:= time;
  1105 missionTimer:= time;
  1099 if missionTex <> nil then FreeTexture(missionTex);
  1106 if missionTex <> nil then 
       
  1107     FreeTexture(missionTex);
       
  1108 missionTex:= nil;
  1100 
  1109 
  1101 if icon > -1 then
  1110 if icon > -1 then
  1102     begin
  1111     begin
  1103     r.x:= 0;
  1112     r.x:= 0;
  1104     r.y:= icon * 32;
  1113     r.y:= icon * 32;