Changeset 71 for trunk/Forms/UFormMain.pas
- Timestamp:
- Sep 28, 2014, 8:53:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.