Changeset 125 for trunk/Forms/UFormMain.pas
- Timestamp:
- Jun 17, 2017, 2:24:51 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r111 r125 131 131 begin 132 132 DrawStart := Now; 133 if Assigned(Core. Player) then134 with Core. Playerdo begin133 if Assigned(Core.CurrentClient) then 134 with Core.CurrentClient do begin 135 135 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height); 136 136 if csOpaque in PaintBox1.ControlStyle then begin … … 138 138 TempBitmap.Canvas.Brush.Color := clBackground; //PaintBox1.GetColorResolvingParent; 139 139 TempBitmap.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); 140 Paint(TempBitmap.Canvas); 140 if Assigned(ControlPlayer) then ControlPlayer.Paint(TempBitmap.Canvas, View) 141 else Core.Game.Map.Paint(TempBitmap.Canvas, View); 141 142 PaintBox1.Canvas.Draw(0, 0, TempBitmap); 142 143 end else begin … … 145 146 PaintBox1.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); 146 147 {$endif} 147 Paint(PaintBox1.Canvas); 148 if Assigned(ControlPlayer) then ControlPlayer.Paint(PaintBox1.Canvas, View) 149 else Core.Game.Map.Paint(PaintBox1.Canvas, View); 148 150 end; 149 151 end; … … 158 160 procedure TFormMain.PaintBox1Resize(Sender: TObject); 159 161 begin 160 if Assigned(Core. Player) then161 with Core. Playerdo162 if Assigned(Core.CurrentClient) then 163 with Core.CurrentClient do 162 164 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height); 163 165 Redraw; … … 251 253 NewZoom: Single; 252 254 begin 253 with Core, Game, Player, View do begin255 with Core, Game, CurrentClient, View do begin 254 256 MapRect := Map.GetPixelRect; 255 257 Factor := FloatPoint((DestRect.Right - DestRect.Left) / (MapRect.Right - MapRect.Left), … … 284 286 procedure TFormMain.AZoomInExecute(Sender: TObject); 285 287 begin 286 with Core. Playerdo begin288 with Core.CurrentClient do begin 287 289 View.Zoom := View.Zoom * ZoomFactor; 288 290 end; … … 294 296 D: TPoint; 295 297 begin 296 with Core. Playerdo begin298 with Core.CurrentClient do begin 297 299 //D := Point(Trunc(MousePos.X - View.Left / ViewZoom), 298 300 // Trunc(MousePos.Y - View.Top / ViewZoom)); … … 323 325 if (Key = 27) or (Key = 17) then 324 326 if Assigned(Core.Game.CurrentPlayer) then begin 325 Core. Game.CurrentPlayer.View.SelectedCell := nil;327 Core.CurrentClient.View.SelectedCell := nil; 326 328 Redraw; 327 329 end; … … 341 343 begin 342 344 if Button = mbLeft then begin 343 if Core.Game.CurrentPlayer.Mode = pmHumanthen begin345 if Assigned(Core.CurrentClient) then begin 344 346 StartMousePoint := Point(X, Y); 345 StartViewPoint := Core. Game.CurrentPlayer.View.SourceRect.TopLeft;347 StartViewPoint := Core.CurrentClient.View.SourceRect.TopLeft; 346 348 MoveActive := True; 347 349 end; … … 361 363 CellPos: TPoint; 362 364 begin 363 if Assigned(Core. Game.CurrentPlayer) then begin365 if Assigned(Core.CurrentClient) then begin 364 366 if MoveActive then 365 367 if (Abs(StartMousePoint.X - X) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) or 366 368 (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then 367 with Core.Game.CurrentPlayer do begin 368 if Mode = pmHuman then begin 369 View.SourceRect := Bounds(Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 370 Trunc(StartViewPoint.Y + (StartMousePoint.Y - Y) / View.Zoom), 371 View.SourceRect.Right - View.SourceRect.Left, 372 View.SourceRect.Bottom - View.SourceRect.Top); 373 Redraw; 374 end; 369 with Core.Game.CurrentPlayer, Core.CurrentClient do begin 370 View.SourceRect := Bounds(Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 371 Trunc(StartViewPoint.Y + (StartMousePoint.Y - Y) / View.Zoom), 372 View.SourceRect.Right - View.SourceRect.Left, 373 View.SourceRect.Bottom - View.SourceRect.Top); 374 Redraw; 375 375 end; 376 376 Cell := nil; 377 OldCell := Core. Game.CurrentPlayer.View.FocusedCell;377 OldCell := Core.CurrentClient.View.FocusedCell; 378 378 with Core.Game do 379 Cell := Map.PosToCell(C urrentPlayer.View.CanvasToCellPos(Point(X, Y)), CurrentPlayer.View );379 Cell := Map.PosToCell(Core.CurrentClient.View.CanvasToCellPos(Point(X, Y)), Core.CurrentClient.View ); 380 380 if Assigned(Cell) then begin 381 Core. Game.CurrentPlayer.View.FocusedCell := Cell;381 Core.CurrentClient.View.FocusedCell := Cell; 382 382 StatusBar1.Panels[0].Text := '[' + IntToStr(Cell.PosPx.X) + ', ' + IntToStr(Cell.PosPx.Y) + 383 383 '] (' + IntToStr(Cell.MovesFrom.Count) + ', ' + IntToStr(Cell.MovesTo.Count) + ')'; 384 384 end else begin 385 Core. Game.CurrentPlayer.View.FocusedCell := nil;385 Core.CurrentClient.View.FocusedCell := nil; 386 386 StatusBar1.Panels[0].Text := ''; 387 387 end; 388 CellPos := Core. Game.CurrentPlayer.View.CanvasToCellPos(Point(X, Y));388 CellPos := Core.CurrentClient.View.CanvasToCellPos(Point(X, Y)); 389 389 StatusBar1.Panels[2].Text := 'CellPos: ' + IntToStr(CellPos.X) + ', ' + IntToStr(CellPos.Y); 390 390 if Cell <> OldCell then Redraw; … … 398 398 (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin 399 399 if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) then begin 400 Core. Game.CurrentPlayer.View.SelectCell(Point(X, Y), Core.Game.CurrentPlayer, Shift);400 Core.CurrentClient.View.SelectCell(Point(X, Y), Core.Game.CurrentPlayer, Shift); 401 401 Redraw; 402 402 end;
Note:
See TracChangeset
for help on using the changeset viewer.