hedgewars/uWorld.pas
changeset 6380 1ff5ad1d771b
parent 6302 db8bdbb34e03
child 6394 f0a9042e7387
equal deleted inserted replaced
6379:ef4288298e57 6380:1ff5ad1d771b
  1085         t:= i mod 60;
  1085         t:= i mod 60;
  1086         s:= inttostr(t) + ':' + s;
  1086         s:= inttostr(t) + ':' + s;
  1087         if t < 10 then s:= '0' + s;
  1087         if t < 10 then s:= '0' + s;
  1088         s:= inttostr(i div 60) + ':' + s;
  1088         s:= inttostr(i div 60) + ':' + s;
  1089    
  1089    
  1090         if timeTexture <> nil then
       
  1091             FreeTexture(timeTexture);
       
  1092         timeTexture:= nil;
       
  1093     
  1090     
  1094         tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
  1091         tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
  1095         tmpSurface:= doSurfaceConversion(tmpSurface);
  1092         tmpSurface:= doSurfaceConversion(tmpSurface);
       
  1093         FreeTexture(timeTexture);
  1096         timeTexture:= Surface2Tex(tmpSurface, false);
  1094         timeTexture:= Surface2Tex(tmpSurface, false);
  1097         SDL_FreeSurface(tmpSurface)
  1095         SDL_FreeSurface(tmpSurface)
  1098     end;
  1096     end;
  1099 
  1097 
  1100     if timeTexture <> nil then
  1098     if timeTexture <> nil then
  1106         begin
  1104         begin
  1107             FPS:= Frames;
  1105             FPS:= Frames;
  1108             Frames:= 0;
  1106             Frames:= 0;
  1109             CountTicks:= 0;
  1107             CountTicks:= 0;
  1110             s:= inttostr(FPS) + ' fps';
  1108             s:= inttostr(FPS) + ' fps';
  1111             if fpsTexture <> nil then
       
  1112                 FreeTexture(fpsTexture);
       
  1113             fpsTexture:= nil;
       
  1114             tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
  1109             tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
  1115             tmpSurface:= doSurfaceConversion(tmpSurface);
  1110             tmpSurface:= doSurfaceConversion(tmpSurface);
       
  1111             FreeTexture(fpsTexture);
  1116             fpsTexture:= Surface2Tex(tmpSurface, false);
  1112             fpsTexture:= Surface2Tex(tmpSurface, false);
  1117             SDL_FreeSurface(tmpSurface)
  1113             SDL_FreeSurface(tmpSurface)
  1118         end;
  1114         end;
  1119         if fpsTexture <> nil then
  1115         if fpsTexture <> nil then
  1120             DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture);
  1116             DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture);
  1314 r.w:= 32;
  1310 r.w:= 32;
  1315 r.h:= 32;
  1311 r.h:= 32;
  1316 
  1312 
  1317 if time = 0 then time:= 5000;
  1313 if time = 0 then time:= 5000;
  1318 missionTimer:= time;
  1314 missionTimer:= time;
  1319 if missionTex <> nil then
  1315 FreeTexture(missionTex);
  1320     FreeTexture(missionTex);
       
  1321 missionTex:= nil;
       
  1322 
  1316 
  1323 if icon > -1 then
  1317 if icon > -1 then
  1324     begin
  1318     begin
  1325     r.x:= 0;
  1319     r.x:= 0;
  1326     r.y:= icon * 32;
  1320     r.y:= icon * 32;
  1382 
  1376 
  1383 procedure freeModule;
  1377 procedure freeModule;
  1384 begin
  1378 begin
  1385     stereoDepth:= stereoDepth; // avoid hint
  1379     stereoDepth:= stereoDepth; // avoid hint
  1386     FreeTexture(fpsTexture);
  1380     FreeTexture(fpsTexture);
       
  1381     fpsTexture:= nil;
  1387     FreeTexture(timeTexture);
  1382     FreeTexture(timeTexture);
       
  1383     timeTexture:= nil;
  1388     FreeTexture(missionTex);
  1384     FreeTexture(missionTex);
       
  1385     missionTex:= nil
  1389 end;
  1386 end;
  1390 
  1387 
  1391 end.
  1388 end.