Changeset 361 for branches/highdpi/LocalPlayer/UnitStat.pas
- Timestamp:
- Apr 9, 2021, 5:56:50 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/UnitStat.pas
r349 r361 77 77 AgePrepared := -2; 78 78 TitleHeight := DpiScreen.Height; 79 InitButtons ();79 InitButtons; 80 80 81 81 Back := TDpiBitmap.Create; … … 98 98 procedure TUnitStatDlg.CheckAge; 99 99 begin 100 if MainTextureAge <> AgePrepared then 101 begin 102 AgePrepared := MainTextureAge; 100 if MainTexture.Age <> AgePrepared then begin 101 AgePrepared := MainTexture.Age; 103 102 DpiBitCanvas(Back.Canvas, 0, 0, wCommon, hOwnModel, 104 MainTexture.Image.Canvas, ( wMainTexture- wCommon) div 2,105 ( hMainTexture- hOwnModel) div 2);103 MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2, 104 (MainTexture.Height - hOwnModel) div 2); 106 105 DpiBitCanvas(Back.Canvas, wCommon, 0, wCommon, hEnemyModel, 107 MainTexture.Image.Canvas, ( wMainTexture- wCommon) div 2,108 ( hMainTexture- hEnemyModel) div 2);106 MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2, 107 (MainTexture.Height - hEnemyModel) div 2); 109 108 DpiBitCanvas(Back.Canvas, 2 * wCommon, 0, wCommon, hEnemyUnit, 110 MainTexture.Image.Canvas, ( wMainTexture- wCommon) div 2,111 ( hMainTexture- hEnemyUnit) div 2);109 MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2, 110 (MainTexture.Height - hEnemyUnit) div 2); 112 111 DpiBitCanvas(Back.Canvas, 3 * wCommon, 0, wCommon, hEnemyCityDefense, 113 MainTexture.Image.Canvas, ( wMainTexture- wCommon) div 2,114 ( hMainTexture- hEnemyCityDefense) div 2);112 MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2, 113 (MainTexture.Height - hEnemyCityDefense) div 2); 115 114 DpiBitCanvas(Back.Canvas, 4 * wCommon, 0, wCommon, hEnemyCity, 116 MainTexture.Image.Canvas, ( wMainTexture- wCommon) div 2,117 ( hMainTexture- hEnemyCity) div 2);115 MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2, 116 (MainTexture.Height - hEnemyCity) div 2); 118 117 ImageOp_B(Back, Template, 0, 0, 0, 0, 5 * wCommon, hMax); 119 end 118 end; 120 119 end; 121 120 … … 151 150 dec(ecixShow); 152 151 assert(ecixShow >= 0); 153 end 152 end; 154 153 end; 155 154 case Kind of … … 297 296 result := (PPicture.HGr = PTestPicture.HGr) and 298 297 (PPicture.pix = PTestPicture.pix) and 299 (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix])) 298 (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix])); 300 299 end 301 300 else 302 301 result := (MyRO.EnemyModel[emix].owner = mox.owner) and 303 (MyRO.EnemyModel[emix].mix = mox.mix) 302 (MyRO.EnemyModel[emix].mix = mox.mix); 304 303 end; 305 304 306 305 procedure FeatureBar(dst: TDpiBitmap; x, y: integer; const mi: TModelInfo; 307 constT: TTexture);306 T: TTexture); 308 307 var 309 308 i, w, dx, num: integer; … … 371 370 end; { featurebar } 372 371 373 procedure NumberBarS(dst: TDpiBitmap; x, y: integer; Cap, s: string; 374 const T: TTexture); 375 begin 376 DLine(dst.Canvas, x - 2, x + 170, y + 16, T.clBevelShade, T.clBevelLight); 372 procedure NumberBarS(dst: TDpiBitmap; x, y: integer; Cap, s: string; T: TTexture); 373 begin 374 DLine(dst.Canvas, x - 2, x + 170, y + 16, T.ColorBevelShade, T.ColorBevelLight); 377 375 LoweredTextOut(dst.Canvas, -1, T, x - 2, y, Cap); 378 376 RisedTextout(dst.Canvas, x + 170 - BiColorTextWidth(dst.Canvas, s), y, s); … … 437 435 begin 438 436 case i of 439 0: 440 j := imWalls; 441 1: 442 j := imCoastalFort; 443 2: 444 j := imMissileBat; 445 3: 446 j := imBunker 437 0: j := imWalls; 438 1: j := imCoastalFort; 439 2: j := imMissileBat; 440 3: j := imBunker 447 441 end; 448 442 Frame(offscreen.Canvas, x - 1, yImp - 1, x + xSizeSmall, 449 yImp + ySizeSmall, MainTexture. clBevelLight,450 MainTexture. clBevelShade);443 yImp + ySizeSmall, MainTexture.ColorBevelLight, 444 MainTexture.ColorBevelShade); 451 445 DpiBitCanvas(offscreen.Canvas, x, yImp, xSizeSmall, ySizeSmall, 452 446 SmallImp.Canvas, j mod 7 * xSizeSmall, 453 447 (j + SystemIconLines * 7) div 7 * ySizeSmall); 454 inc(x, xSizeSmall + 4) 448 inc(x, xSizeSmall + 4); 455 449 end; 456 450 end; … … 469 463 if IsToCount(MyRO.EnemyUn[MyRO.nEnemyUn + uix].emix) then 470 464 inc(Available); 471 end 465 end; 472 466 end 473 467 else // no supervisor -- can only count stack top units … … 512 506 begin 513 507 MakeUnitInfo(me, MyUn[uixShow], ui); 514 MakeModelInfo(me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi) 508 MakeModelInfo(me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi); 515 509 end 516 510 else … … 518 512 mi := mox^; 519 513 if Kind in [dkEnemyUnit, dkEnemyCityDefense] then 520 ui := MyRO.EnemyUn[euixShow] 514 ui := MyRO.EnemyUn[euixShow]; 521 515 end; 522 516 … … 527 521 begin 528 522 { Frame(offscreen.canvas,xView-1,yView-1,xView+64,yView+48, 529 MainTexture. clBevelShade,MainTexture.clBevelLight);523 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); 530 524 RFrame(offscreen.canvas,xView-2,yView-2,xView+65,yView+49, 531 MainTexture. clBevelShade,MainTexture.clBevelLight); }525 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); } 532 526 with offscreen.Canvas do 533 527 begin … … 541 535 begin 542 536 x := 1 + 2 * (xxt * 2 + 1); 543 y := 1 + yyt + 2 * (yyt * 3 + 1) 537 y := 1 + yyt + 2 * (yyt * 3 + 1); 544 538 end 545 539 else 546 540 begin 547 541 x := integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1; 548 y := 1 + yyt 542 y := 1 + yyt; 549 543 end; 550 544 for j := -1 to 1 do … … 594 588 (ClientWidth - BiColorTextWidth(offscreen.Canvas, s)) div 2, 595 589 yView + 80, s); 596 end 590 end; 597 591 end 598 592 else … … 615 609 Phrases.Lookup('UNITCOST')); 616 610 DLine(offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16, 617 MainTexture. clBevelShade, MainTexture.clBevelLight);611 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 618 612 if G.Difficulty[me] = 0 then 619 613 s := IntToStr(mi.cost) … … 636 630 (yTotal + StatDown - 19), Phrases.Lookup('UNITINTRO')); 637 631 DLine(offscreen.Canvas, xTotal - 2, xTotal + 170, 638 (yTotal + StatDown - 19) + 16, MainTexture. clTextShade,639 MainTexture. clTextLight);632 (yTotal + StatDown - 19) + 16, MainTexture.ColorTextShade, 633 MainTexture.ColorTextLight); 640 634 s := TurnToString(MyModel[mixShow].IntroTurn); 641 635 RisedTextout(offscreen.Canvas, … … 675 669 ConscriptsBtn.ButtonIndex := 29; 676 670 ConscriptsBtn.Hint := Phrases.Lookup('BTN_ALLOWCONSCRIPTS'); 677 end 671 end; 678 672 end 679 673 else if Kind = dkEnemyModel then … … 685 679 NumberBar(offscreen, xTotal, yTotal + StatDown, 686 680 Phrases.Lookup('UNITKNOWN'), Available, MainTexture); 687 end 681 end; 688 682 end; 689 683 end; … … 705 699 procedure TUnitStatDlg.ModelBoxChange(Sender: TObject); 706 700 begin 707 SmartUpdateContent 701 SmartUpdateContent; 708 702 end; 709 703 … … 720 714 SwitchBtn.ButtonIndex := 11; 721 715 SwitchBtn.Hint := Phrases.Lookup('BTN_NONOBSOLETE'); 722 end 716 end; 723 717 end; 724 718 … … 735 729 ConscriptsBtn.ButtonIndex := 29; 736 730 ConscriptsBtn.Hint := Phrases.Lookup('BTN_ALLOWCONSCRIPTS'); 737 end 731 end; 738 732 end; 739 733 740 734 procedure TUnitStatDlg.HelpBtnClick(Sender: TObject); 741 735 begin 742 HelpDlg.ShowNewContent(wmPersistent, hkModel, 0) 736 HelpDlg.ShowNewContent(wmPersistent, hkModel, 0); 743 737 end; 744 738
Note:
See TracChangeset
for help on using the changeset viewer.