- Timestamp:
- Sep 24, 2019, 8:22:47 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Game2048.lpi
r2 r4 2 2 <CONFIG> 3 3 <ProjectOptions> 4 <Version Value="1 0"/>4 <Version Value="11"/> 5 5 <General> 6 6 <SessionStorage Value="InProjectDir"/> … … 14 14 <Icon Value="0"/> 15 15 </General> 16 <BuildModes Count="1"> 17 <Item1 Name="Default" Default="True"/> 16 <BuildModes Count="2"> 17 <Item1 Name="Debug" Default="True"/> 18 <Item2 Name="Release"> 19 <CompilerOptions> 20 <Version Value="11"/> 21 <Target> 22 <Filename Value="Game2048"/> 23 </Target> 24 <SearchPaths> 25 <IncludeFiles Value="$(ProjOutDir)"/> 26 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 27 </SearchPaths> 28 <Parsing> 29 <SyntaxOptions> 30 <SyntaxMode Value="Delphi"/> 31 <CStyleOperator Value="False"/> 32 <AllowLabel Value="False"/> 33 <CPPInline Value="False"/> 34 </SyntaxOptions> 35 </Parsing> 36 <CodeGeneration> 37 <SmartLinkUnit Value="True"/> 38 <Optimizations> 39 <OptimizationLevel Value="3"/> 40 </Optimizations> 41 </CodeGeneration> 42 <Linking> 43 <Debugging> 44 <GenerateDebugInfo Value="False"/> 45 </Debugging> 46 <LinkSmart Value="True"/> 47 <Options> 48 <Win32> 49 <GraphicApplication Value="True"/> 50 </Win32> 51 </Options> 52 </Linking> 53 </CompilerOptions> 54 </Item2> 18 55 </BuildModes> 19 56 <PublishOptions> … … 21 58 </PublishOptions> 22 59 <RunParams> 23 <local> 24 <FormatVersion Value="1"/> 25 </local> 60 <FormatVersion Value="2"/> 61 <Modes Count="1"> 62 <Mode0 Name="default"/> 63 </Modes> 26 64 </RunParams> 27 65 <RequiredPackages Count="1"> … … 50 88 <IsPartOfProject Value="True"/> 51 89 <ComponentName Value="FormNew"/> 90 <HasResources Value="True"/> 52 91 <ResourceBaseClass Value="Form"/> 53 92 </Unit3> … … 61 100 <SearchPaths> 62 101 <IncludeFiles Value="$(ProjOutDir)"/> 63 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) "/>102 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 64 103 </SearchPaths> 104 <Parsing> 105 <SyntaxOptions> 106 <SyntaxMode Value="Delphi"/> 107 <CStyleOperator Value="False"/> 108 <IncludeAssertionCode Value="True"/> 109 <AllowLabel Value="False"/> 110 <CPPInline Value="False"/> 111 </SyntaxOptions> 112 </Parsing> 113 <CodeGeneration> 114 <Checks> 115 <IOChecks Value="True"/> 116 <RangeChecks Value="True"/> 117 <OverflowChecks Value="True"/> 118 <StackChecks Value="True"/> 119 </Checks> 120 <VerifyObjMethodCallValidity Value="True"/> 121 </CodeGeneration> 65 122 <Linking> 123 <Debugging> 124 <UseHeaptrc Value="True"/> 125 <UseExternalDbgSyms Value="True"/> 126 </Debugging> 66 127 <Options> 67 128 <Win32> -
trunk/UGame.pas
r3 r4 200 200 CellSize: TPoint; 201 201 ValueStr: string; 202 Frame: TRect; 202 203 begin 203 204 CellSize := Point(Canvas.Width div Size.X, Canvas.Height div Size.Y); 205 if CellSize.X < CellSize.Y then CellSize.Y := CellSize.X; 206 if CellSize.Y < CellSize.X then CellSize.X := CellSize.Y; 207 Frame := Rect(Canvas.Width div 2 - (Size.X * CellSize.X) div 2, 208 Canvas.Height div 2 - (Size.Y * CellSize.Y) div 2, 209 Canvas.Width div 2 + (Size.X * CellSize.X) div 2, 210 Canvas.Height div 2 + (Size.Y * CellSize.Y) div 2); 211 204 212 Canvas.FillRect(0, 0, Canvas.Width, Canvas.Height); 205 213 Canvas.Font.Color := clBlack; … … 209 217 Canvas.Brush.Color := GetCellColor(Cells[Y, X].Value); 210 218 Canvas.Brush.Style := bsSolid; 211 Canvas.FillRect(Rect( X * CellSize.X,Y * CellSize.Y,212 (X + 1) * CellSize.X,(Y + 1) * CellSize.Y));219 Canvas.FillRect(Rect(Frame.Left + X * CellSize.X, Frame.Top + Y * CellSize.Y, 220 Frame.Left + (X + 1) * CellSize.X, Frame.Top + (Y + 1) * CellSize.Y)); 213 221 if Cells[Y, X].Value <> 0 then begin 214 222 ValueStr := IntToStr(Cells[Y, X].Value); 215 Canvas.TextOut(X * CellSize.X + CellSize.X div 2 - 216 Canvas.TextWidth(ValueStr) div 2, Y * CellSize.Y, ValueStr); 223 Canvas.TextOut(Frame.Left + X * CellSize.X + CellSize.X div 2 - 224 Canvas.TextWidth(ValueStr) div 2, 225 Frame.Top + Y * CellSize.Y, ValueStr); 217 226 end; 218 227 end; 219 228 220 229 for Y := 0 to Size.Y - 1 do begin 221 Canvas.MoveTo( 0,Y * CellSize.Y);222 Canvas.LineTo( Canvas.Width,Y * CellSize.Y);230 Canvas.MoveTo(Frame.Left, Frame.Top + Y * CellSize.Y); 231 Canvas.LineTo(Frame.Left + Size.X * CellSize.X, Frame.Top + Y * CellSize.Y); 223 232 end; 224 233 for X := 0 to Size.X - 1 do begin 225 Canvas.MoveTo(X * CellSize.X, 0); 226 Canvas.LineTo(X * CellSize.X, Canvas.Height); 227 end; 234 Canvas.MoveTo(Frame.Left + X * CellSize.X, Frame.Top); 235 Canvas.LineTo(Frame.Left + X * CellSize.X, Frame.Top + Size.Y * CellSize.Y); 236 end; 237 Canvas.Brush.Style := bsClear; 238 Canvas.Rectangle(Frame); 228 239 end; 229 240
Note:
See TracChangeset
for help on using the changeset viewer.