- Timestamp:
- Feb 3, 2020, 12:24:17 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.lpk
r8 r69 40 40 <License Value="GNU/GPL"/> 41 41 <Version Minor="7"/> 42 <Files Count="2 4">42 <Files Count="26"> 43 43 <Item1> 44 44 <Filename Value="StopWatch.pas"/> … … 140 140 </Item22> 141 141 <Item23> 142 <Filename Value="U Languages.pas"/>143 <UnitName Value="U Languages"/>142 <Filename Value="UMetaCanvas.pas"/> 143 <UnitName Value="UMetaCanvas"/> 144 144 </Item23> 145 145 <Item24> 146 <Filename Value="UGeometric.pas"/> 147 <UnitName Value="UGeometric"/> 148 </Item24> 149 <Item25> 146 150 <Filename Value="UTranslator.pas"/> 147 151 <HasRegisterProc Value="True"/> 148 152 <UnitName Value="UTranslator"/> 149 </Item24> 153 </Item25> 154 <Item26> 155 <Filename Value="ULanguages.pas"/> 156 <UnitName Value="ULanguages"/> 157 </Item26> 150 158 </Files> 151 159 <i18n> -
trunk/Packages/Common/Common.pas
r8 r69 12 12 UMemory, UResetableThread, UPool, ULastOpenedList, URegistry, 13 13 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, U Languages,15 U Translator, LazarusPackageIntf;14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas, 15 UGeometric, UTranslator, ULanguages, LazarusPackageIntf; 16 16 17 17 implementation -
trunk/UGame.pas
r68 r69 195 195 196 196 uses 197 UCore ;197 UCore, UMetaCanvas; 198 198 199 199 procedure Translate; … … 618 618 TileCenter: TPoint; 619 619 S: TPoint; 620 begin 620 MetaCanvas: TMetaCanvas; 621 begin 622 MetaCanvas := TMetaCanvas.Create; 623 621 624 TopBarHeight := ScaleY(24, 96); 622 Canvas.Brush.Style := bsSolid;623 Canvas.Brush.Color := Core.ThemeManager1.Theme.ColorControl;624 Canvas.FillRect(0, 0, Canvas.Width,Canvas.Height);625 MetaCanvas.Brush.Style := bsSolid; 626 MetaCanvas.Brush.Color := Core.ThemeManager1.Theme.ColorControl; 627 MetaCanvas.FillRect(0, 0, MetaCanvas.Width, MetaCanvas.Height); 625 628 626 629 ValueStr := SScore + ': ' + IntToStr(Score); 627 Canvas.Font.Color := Core.ThemeManager1.Theme.ColorControlText;628 Canvas.Font.Height := Trunc(TopBarHeight * 0.7);629 Canvas.TextOut(ScaleY(16, 96), (TopBarHeight -Canvas.TextHeight(ValueStr)) div 2, ValueStr);630 MetaCanvas.Font.Color := Core.ThemeManager1.Theme.ColorControlText; 631 MetaCanvas.Font.Height := Trunc(TopBarHeight * 0.7); 632 MetaCanvas.TextOut(ScaleY(16, 96), (TopBarHeight - MetaCanvas.TextHeight(ValueStr)) div 2, ValueStr); 630 633 631 634 ValueStr := STopScore + ': ' + IntToStr(TopScore); 632 Canvas.Font.Color := Core.ThemeManager1.Theme.ColorControlText;633 Canvas.Font.Height := Trunc(TopBarHeight * 0.7);634 Canvas.TextOut(ScaleY(136, 96), (TopBarHeight -Canvas.TextHeight(ValueStr)) div 2, ValueStr);635 MetaCanvas.Font.Color := Core.ThemeManager1.Theme.ColorControlText; 636 MetaCanvas.Font.Height := Trunc(TopBarHeight * 0.7); 637 MetaCanvas.TextOut(ScaleY(136, 96), (TopBarHeight - MetaCanvas.TextHeight(ValueStr)) div 2, ValueStr); 635 638 636 639 // Form.Canvas.Width and Form.Canvas.Height is not working correctly under Windows. … … 647 650 TileMargin := Round(Frame.Width / Board.Size.X * 0.03); 648 651 649 Canvas.Brush.Style := bsSolid;650 Canvas.Brush.Color := clGray;651 Canvas.Pen.Style := psClear;652 Canvas.RoundRect(Frame, ScaleX(Frame.Width div (20 * Board.Size.X), 96),652 MetaCanvas.Brush.Style := bsSolid; 653 MetaCanvas.Brush.Color := clGray; 654 MetaCanvas.Pen.Style := psClear; 655 MetaCanvas.RoundRect(Frame, ScaleX(Frame.Width div (20 * Board.Size.X), 96), 653 656 ScaleY(Frame.Height div (20 * Board.Size.Y), 96)); 654 657 … … 657 660 TileSize := Point(Frame.Width div Board.Size.X, Frame.Height div Board.Size.Y); 658 661 659 Canvas.Font.Color := clBlack;662 MetaCanvas.Font.Color := clBlack; 660 663 661 664 // Draw static tiles 662 665 for Y := 0 to Board.Size.Y - 1 do 663 666 for X := 0 to Board.Size.X - 1 do begin 664 if (Board.Tiles[Y, X].Action <> taNone) then Canvas.Brush.Color := GetTileColor(0)665 else Canvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value);666 Canvas.Brush.Style := bsSolid;667 if (Board.Tiles[Y, X].Action <> taNone) then MetaCanvas.Brush.Color := GetTileColor(0) 668 else MetaCanvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value); 669 MetaCanvas.Brush.Style := bsSolid; 667 670 TileRect := Bounds( 668 671 Frame.Left + X * TileSize.X + TileMargin, 669 672 Frame.Top + Y * TileSize.Y + TileMargin, 670 673 TileSize.X - 2 * TileMargin, TileSize.Y - 2 * TileMargin); 671 RenderTile( Canvas, Board.Tiles[Y, X], TileRect, Board.Tiles[Y, X].Action = taNone);674 RenderTile(MetaCanvas, Board.Tiles[Y, X], TileRect, Board.Tiles[Y, X].Action = taNone); 672 675 end; 673 676 … … 676 679 for X := 0 to Board.Size.X - 1 do 677 680 if Board.Tiles[Y, X].Action = taMove then begin 678 Canvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value);679 Canvas.Brush.Style := bsSolid;681 MetaCanvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value); 682 MetaCanvas.Brush.Style := bsSolid; 680 683 TileRect := Bounds( 681 684 Frame.Left + X * TileSize.X + Trunc(Board.Tiles[Y, X].Shift.X / 100 * TileSize.X + TileMargin), 682 685 Frame.Top + Y * TileSize.Y + Trunc(Board.Tiles[Y, X].Shift.Y / 100 * TileSize.Y + TileMargin), 683 686 TileSize.X - 2 * TileMargin, TileSize.Y - 2 * TileMargin); 684 RenderTile( Canvas, Board.Tiles[Y, X], TileRect, True);687 RenderTile(MetaCanvas, Board.Tiles[Y, X], TileRect, True); 685 688 end; 686 689 … … 689 692 for X := 0 to Board.Size.X - 1 do 690 693 if Board.Tiles[Y, X].Action = taAppear then begin 691 Canvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value);692 Canvas.Brush.Style := bsSolid;694 MetaCanvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value); 695 MetaCanvas.Brush.Style := bsSolid; 693 696 TileRect := Bounds( 694 697 Frame.Left + X * TileSize.X + TileMargin, … … 703 706 TileRect := Rect(TileCenter.X - S.X div 2, TileCenter.Y - S.Y div 2, 704 707 TileCenter.X + S.X div 2, TileCenter.Y + S.Y div 2); 705 RenderTile( Canvas, Board.Tiles[Y, X], TileRect, True);708 RenderTile(MetaCanvas, Board.Tiles[Y, X], TileRect, True); 706 709 end; 707 710 … … 710 713 for X := 0 to Board.Size.X - 1 do 711 714 if Board.Tiles[Y, X].Action = taMerge then begin 712 Canvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value);713 Canvas.Brush.Style := bsSolid;715 MetaCanvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value); 716 MetaCanvas.Brush.Style := bsSolid; 714 717 TileRect := Bounds( 715 718 Frame.Left + X * TileSize.X + TileMargin, … … 723 726 TileRect := Rect(TileRect.Left - S.X, TileRect.Top - S.Y, 724 727 TileRect.Right + S.X, TileRect.Bottom + S.Y); 725 RenderTile(Canvas, Board.Tiles[Y, X], TileRect, True); 726 end; 728 RenderTile(MetaCanvas, Board.Tiles[Y, X], TileRect, True); 729 end; 730 731 MetaCanvas.DrawTo(Canvas); 732 MetaCanvas.Free; 727 733 end; 728 734
Note:
See TracChangeset
for help on using the changeset viewer.