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 |
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; |