Ignore:
Timestamp:
Sep 19, 2018, 5:28:58 PM (6 years ago)
Author:
chronos
Message:
  • Added: Unfinished implementation of cyclic map drawing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormClient.pas

    r231 r234  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM,
     9  UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM, Math,
    1010  UGeometry, UGameClient, UGameProtocol, UThreading, UPlayer, UClientGUI;
    1111
     
    167167var
    168168  DrawStart: TDateTime;
     169  R: TRect;
     170  StartP: TPoint;
     171  VS: TPoint;
     172  CountP: TPoint;
     173  X, Y: Integer;
     174  TempView: TView;
    169175const
    170176  BackgroundColor = $404040;
     
    185191      PaintBox1.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    186192      {$endif}
    187       Client.Paint(PaintBox1.Canvas, View)
     193
     194    {  if Game.CyclicMap then begin
     195        VS := View.CellToCanvasPos(Game.Map.Size);
     196        TempView := TView.Create;
     197        TempView.Game := Game;
     198        R := TRect.Create(View.CellToCanvasPos(Game.Map.Cells.First.PosPx),
     199          View.CellToCanvasPos(Game.Map.Cells.Last.PosPx));
     200        StartP := TPoint.Create(Ceil(R.P1.X / R.Size.X) * R.Size.X,
     201          Ceil(R.P1.Y / R.Size.Y) * R.Size.Y);
     202        CountP := TPoint.Create(Ceil(View.DestRect.Size.X / R.Size.X),
     203          Ceil(View.DestRect.Size.X / R.Size.Y));
     204        for Y := 0 to CountP.Y do begin
     205          for X := 0 to CountP.X do begin
     206            TempView.Zoom := View.Zoom;
     207            TempView.SourceRect := View.SourceRect;
     208            TempView.DestRect := TRect.Create(
     209            TPoint.Create(
     210              -StartP.X + R.Size.X * X,
     211              -StartP.Y + R.Size.Y * Y),
     212            TPoint.Create(
     213              -StartP.X + R.Size.X * X + View.DestRect.Size.X,
     214              -StartP.Y + R.Size.Y * Y + View.DestRect.Size.Y)
     215            );
     216            Client.Paint(PaintBox1.Canvas, TempView);
     217          end;
     218        end;
     219        TempView.Free;
     220      end else
     221      }Client.Paint(PaintBox1.Canvas, View);
    188222    end;
    189223  end;
Note: See TracChangeset for help on using the changeset viewer.