hedgewars/uStore.pas
changeset 10122 cefede760264
parent 10120 b7f632c12784
child 10123 64e72781d344
equal deleted inserted replaced
10121:8b65699beb56 10122:cefede760264
    42 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    42 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    43 
    43 
    44 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
    44 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
    45 procedure SetupOpenGL;
    45 procedure SetupOpenGL;
    46 procedure SetScale(f: GLfloat);
    46 procedure SetScale(f: GLfloat);
    47 function  RenderHelpWindow(caption, subcaption, description, extra: PChar; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    47 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    48 procedure RenderWeaponTooltip(atype: TAmmoType);
    48 procedure RenderWeaponTooltip(atype: TAmmoType);
    49 procedure ShowWeaponTooltip(x, y: LongInt);
    49 procedure ShowWeaponTooltip(x, y: LongInt);
    50 procedure FreeWeaponTooltip;
    50 procedure FreeWeaponTooltip;
    51 procedure MakeCrossHairs;
    51 procedure MakeCrossHairs;
    52 {$IFDEF USE_VIDEO_RECORDING}
    52 {$IFDEF USE_VIDEO_RECORDING}
  1227     FreeTexture(ProgrTex);
  1227     FreeTexture(ProgrTex);
  1228     ProgrTex:= nil;
  1228     ProgrTex:= nil;
  1229     Step:= 0
  1229     Step:= 0
  1230 end;
  1230 end;
  1231 
  1231 
  1232 function RenderHelpWindow(caption, subcaption, description, extra: PChar; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
  1232 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
  1233 var tmpsurf: PSDL_SURFACE;
  1233 var tmpsurf: PSDL_SURFACE;
  1234     w, h, i, j: LongInt;
  1234     w, h, i, j: LongInt;
  1235     font: THWFont;
  1235     font: THWFont;
  1236     r, r2: TSDL_Rect;
  1236     r, r2: TSDL_Rect;
  1237     wa, ha: LongInt;
  1237     wa, ha: LongInt;
  1256 i:= 0; j:= 0; // avoid compiler hints
  1256 i:= 0; j:= 0; // avoid compiler hints
  1257 
  1257 
  1258 // TODO: Recheck height/position calculation
  1258 // TODO: Recheck height/position calculation
  1259 
  1259 
  1260 // get caption's dimensions
  1260 // get caption's dimensions
  1261 TTF_SizeUTF8(Fontz[font].Handle, caption, @i, @j);
  1261 TTF_SizeUTF8(Fontz[font].Handle, PChar(caption), @i, @j);
  1262 // width adds 36 px (image + space)
  1262 // width adds 36 px (image + space)
  1263 w:= i + 36 + wa;
  1263 w:= i + 36 + wa;
  1264 h:= j + ha;
  1264 h:= j + ha;
  1265 
  1265 
  1266 // get sub caption's dimensions
  1266 // get sub caption's dimensions
  1267 TTF_SizeUTF8(Fontz[font].Handle, subcaption, @i, @j);
  1267 TTF_SizeUTF8(Fontz[font].Handle, PChar(subcaption), @i, @j);
  1268 // width adds 36 px (image + space)
  1268 // width adds 36 px (image + space)
  1269 if w < (i + 36 + wa) then
  1269 if w < (i + 36 + wa) then
  1270     w:= i + 36 + wa;
  1270     w:= i + 36 + wa;
  1271 inc(h, j + ha);
  1271 inc(h, j + ha);
  1272 
  1272 
  1286     end;
  1286     end;
  1287 
  1287 
  1288 if extra <> '' then
  1288 if extra <> '' then
  1289     begin
  1289     begin
  1290     // get extra label's dimensions
  1290     // get extra label's dimensions
  1291     TTF_SizeUTF8(Fontz[font].Handle, extra, @i, @j);
  1291     TTF_SizeUTF8(Fontz[font].Handle, PChar(extra), @i, @j);
  1292     if w < (i + wa) then
  1292     if w < (i + wa) then
  1293         w:= i + wa;
  1293         w:= i + wa;
  1294     inc(h, j + ha);
  1294     inc(h, j + ha);
  1295     end;
  1295     end;
  1296 
  1296 
  1307 r.w:= w;
  1307 r.w:= w;
  1308 r.h:= h;
  1308 r.h:= h;
  1309 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, tmpsurf, true);
  1309 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, tmpsurf, true);
  1310 
  1310 
  1311 // render caption
  1311 // render caption
  1312 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, ha, $ffffffff, font, caption);
  1312 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, ha, $ffffffff, font, PChar(caption));
  1313 // render sub caption
  1313 // render sub caption
  1314 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, r.y + r.h, $ffc7c7c7, font, subcaption);
  1314 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, r.y + r.h, $ffc7c7c7, font, PChar(subcaption));
  1315 
  1315 
  1316 // render all description lines
  1316 // render all description lines
  1317 tmpdesc:= description;
  1317 tmpdesc:= description;
  1318 while length(tmpdesc) > 0 do
  1318 while length(tmpdesc) > 0 do
  1319     begin
  1319     begin
  1331             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, PChar(tmpline + ':'));
  1331             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, PChar(tmpline + ':'));
  1332         end
  1332         end
  1333     end;
  1333     end;
  1334 
  1334 
  1335 if extra <> '' then
  1335 if extra <> '' then
  1336     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, extra);
  1336     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, PChar(extra));
  1337 
  1337 
  1338 r.x:= cFontBorder + 6;
  1338 r.x:= cFontBorder + 6;
  1339 r.y:= cFontBorder + 4;
  1339 r.y:= cFontBorder + 4;
  1340 r.w:= 32;
  1340 r.w:= 32;
  1341 r.h:= 32;
  1341 r.h:= 32;
  1347 end;
  1347 end;
  1348 
  1348 
  1349 procedure RenderWeaponTooltip(atype: TAmmoType);
  1349 procedure RenderWeaponTooltip(atype: TAmmoType);
  1350 var r: TSDL_Rect;
  1350 var r: TSDL_Rect;
  1351     i: LongInt;
  1351     i: LongInt;
  1352     extra: PChar;
  1352     extra: ansistring;
  1353     extracolor: LongInt;
  1353     extracolor: LongInt;
  1354 begin
  1354 begin
  1355 // don't do anything if the window shouldn't be shown
  1355 // don't do anything if the window shouldn't be shown
  1356     if (cReducedQuality and rqTooltipsOff) <> 0 then
  1356     if (cReducedQuality and rqTooltipsOff) <> 0 then
  1357         begin
  1357         begin