Changeset 71
- Timestamp:
- Sep 28, 2014, 8:53:50 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r69 r71 1 1 object FormMain: TFormMain 2 Left = 1022 Left = 278 3 3 Height = 621 4 Top = 04 Top = 84 5 5 Width = 775 6 6 Caption = 'xTactics' … … 21 21 Width = 735 22 22 Align = alClient 23 ParentColor = False 23 24 OnMouseDown = PaintBox1MouseDown 24 25 OnMouseMove = PaintBox1MouseMove -
trunk/Forms/UFormMain.pas
r69 r71 89 89 procedure Timer1Timer(Sender: TObject); 90 90 private 91 TempBitmap: TBitmap; 91 92 StartMousePoint: TPoint; 92 93 StartViewPoint: TPoint; 93 94 MoveActive: Boolean; 94 95 RedrawPending: Boolean; 96 DrawDuration: TDateTime; 95 97 public 96 98 procedure LoadConfig(Config: TXmlConfig; Path: string); … … 116 118 117 119 procedure TFormMain.PaintBox1Paint(Sender: TObject); 118 begin 120 var 121 DrawStart: TDateTime; 122 begin 123 DrawStart := Now; 119 124 //if Core.Game.Running then 120 125 if Assigned(Core.Game.CurrentPlayer) then 121 126 with Core.Game.CurrentPlayer do begin 122 127 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height); 123 Paint(PaintBox1); 124 end; 128 if csOpaque in PaintBox1.ControlStyle then begin 129 TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height); 130 TempBitmap.Canvas.Brush.Color := clBackground; //PaintBox1.GetColorResolvingParent; 131 TempBitmap.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); 132 Paint(TempBitmap.Canvas); 133 PaintBox1.Canvas.Draw(0, 0, TempBitmap); 134 end else Paint(PaintBox1.Canvas); 135 end; 136 DrawDuration := Now - DrawStart; 125 137 end; 126 138 127 139 procedure TFormMain.EraseBackground(DC: HDC); 128 140 begin 141 // Do nothing, all background space covered by controls 129 142 end; 130 143 … … 144 157 if RedrawPending then begin 145 158 RedrawPending := False; 146 DrawStart := Now;147 159 PaintBox1.Repaint; 148 StatusBar1.Panels[1].Text := IntToStr(Trunc((Now - DrawStart) / OneMillisecond)) + ' ms'; 149 160 StatusBar1.Panels[1].Text := IntToStr(Trunc(DrawDuration / OneMillisecond)) + ' ms'; 150 161 NewCaption := 'xTactics'; 151 162 if Assigned(Core.Game.CurrentPlayer) then … … 199 210 procedure TFormMain.FormCreate(Sender: TObject); 200 211 begin 212 //PaintBox1.ControlStyle := PaintBox1.ControlStyle + [csOpaque]; 213 //DoubleBuffered := True; 214 TempBitmap := TBitmap.Create; 201 215 end; 202 216 … … 274 288 procedure TFormMain.FormDestroy(Sender: TObject); 275 289 begin 290 TempBitmap.Free; 276 291 end; 277 292 -
trunk/UGame.pas
r70 r71 193 193 procedure LoadFromNode(Node: TDOMNode); 194 194 procedure SaveToNode(Node: TDOMNode); 195 procedure Paint( PaintBox: TPaintBox);195 procedure Paint(Canvas: TCanvas); 196 196 constructor Create; 197 197 destructor Destroy; override; … … 1393 1393 end; 1394 1394 1395 procedure TPlayer.Paint( PaintBox: TPaintBox);1396 begin 1397 Game.Map.Paint( PaintBox.Canvas, View);1395 procedure TPlayer.Paint(Canvas: TCanvas); 1396 begin 1397 Game.Map.Paint(Canvas, View); 1398 1398 end; 1399 1399 … … 2108 2108 Brush.Color := clPurple 2109 2109 else Brush.Color := Cell.GetColor; 2110 Pen.Color := clBlack;2110 //Pen.Color := clBlack; 2111 2111 PaintCell(Canvas, Cell.PosPx, IntToStr(Cell.GetAvialPower), View, Cell); 2112 2112 end;
Note:
See TracChangeset
for help on using the changeset viewer.