Changeset 6 for trunk/UGame.pas
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 4 4 lib 5 5 heaptrclog.trc 6 Game2048.exe
-
- Property svn:ignore
-
trunk/UGame.pas
r5 r6 45 45 procedure New; 46 46 procedure Clear; 47 procedure Render(Canvas: TCanvas );47 procedure Render(Canvas: TCanvas; CanvasSize: TPoint); 48 48 function MoveAll(Direction: TDirection): Integer; 49 49 procedure MoveCell(SourceCell, TargetCell: TCell); … … 198 198 end; 199 199 200 procedure TGame.Render(Canvas: TCanvas );200 procedure TGame.Render(Canvas: TCanvas; CanvasSize: TPoint); 201 201 var 202 202 X, Y: Integer; … … 205 205 Frame: TRect; 206 206 TextSize: TSize; 207 const 208 TopBarHeight = 32; 209 begin 207 TopBarHeight: Integer; 208 begin 209 TopBarHeight := ScaleY(24, 96); 210 210 Canvas.Brush.Style := bsSolid; 211 211 Canvas.Brush.Color := clBlack; 212 212 Canvas.FillRect(0, 0, Canvas.Width, Canvas.Height); 213 213 214 ValueStr := 'Score: ' + IntToStr(Score); 214 215 Canvas.Font.Color := clWhite; 215 Canvas.Font.Height := 20; 216 Canvas.TextOut(16, 4, 'Score: ' + IntToStr(Score)); 217 218 Frame := Rect(0, TopBarHeight, Canvas.Width, Canvas.Height); 216 Canvas.Font.Height := Trunc(TopBarHeight * 0.7); 217 Canvas.TextOut(ScaleY(16, 96), (TopBarHeight - Canvas.TextHeight(ValueStr)) div 2, ValueStr); 218 219 // Form.Canvas.Width and Form.Canvas.Height is not working correctly under Windows. 220 // So dimensions are provided by CanvasSize parameter. 221 Frame := Rect(2, TopBarHeight, CanvasSize.X - 2, CanvasSize.Y - 2); 219 222 CellSize := Point(Frame.Width div Size.X, Frame.Height div Size.Y); 220 223 if CellSize.X < CellSize.Y then CellSize.Y := CellSize.X;
Note:
See TracChangeset
for help on using the changeset viewer.