Changeset 234 for trunk


Ignore:
Timestamp:
Sep 19, 2018, 5:28:58 PM (6 years ago)
Author:
chronos
Message:
  • Added: Unfinished implementation of cyclic map drawing.
Location:
trunk
Files:
4 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;
  • trunk/Languages/xtactics.cs.po

    r231 r234  
    410410#: tformnew.checkboxcyclicmap.caption
    411411msgid "Cyclic map"
    412 msgstr ""
     412msgstr "Cyklická mapa"
    413413
    414414#: tformnew.checkboxfogofwar.caption
     
    758758#: uclientgui.swrongarrowangle
    759759msgid "Wrong arrow angle %s"
    760 msgstr ""
     760msgstr "Nesprávný úhel šipky %s"
    761761
    762762#: uclientgui.szerozoomnotalowed
    763 #, fuzzy
    764763msgctxt "uclientgui.szerozoomnotalowed"
    765764msgid "Zero zoom not allowed"
     
    10141013
    10151014#: umap.scellremoveneighborerror
    1016 #, fuzzy
    10171015msgctxt "umap.scellremoveneighborerror"
    10181016msgid "Can't remove cell from neighbour cell"
     
    10201018
    10211019#: umap.snegativecellpowernotallowed
    1022 #, fuzzy
    10231020msgctxt "umap.snegativecellpowernotallowed"
    10241021msgid "Not allowed to substract power under zero to negative value"
     
    10261023
    10271024#: uplayer.sattackerpowerpositive
    1028 #, fuzzy
    10291025msgctxt "uplayer.sattackerpowerpositive"
    10301026msgid "Attacker power have to be higher then 0."
     
    10321028
    10331029#: uplayer.sdefenderpowerpositive
    1034 #, fuzzy
    10351030msgctxt "uplayer.sdefenderpowerpositive"
    10361031msgid "Defender power have to be higher then or equal to 0."
     
    10381033
    10391034#: uplayer.sunfinishedbattle
    1040 #, fuzzy
    10411035msgctxt "uplayer.sunfinishedbattle"
    10421036msgid "Unfinished battle"
     
    10581052msgid "64-bit UInt read overflow."
    10591053msgstr "Přetečení při čtení 64-bit UInt"
    1060 
  • trunk/UClientGUI.pas

    r233 r234  
    347347function TView.CanvasToCellPos(Pos: TPoint): TPoint;
    348348begin
    349   Result := TPoint.Create(Trunc(Pos.X / Zoom + SourceRect.P1.X),
    350     Trunc(Pos.Y / Zoom + SourceRect.P1.Y));
     349  Result := TPoint.Create(Trunc((Pos.X - DestRect.P1.X) / Zoom + SourceRect.P1.X),
     350    Trunc((Pos.Y - DestRect.P1.Y) / Zoom + SourceRect.P1.Y));
    351351end;
    352352
    353353function TView.CellToCanvasPos(Pos: TPoint): TPoint;
    354354begin
    355   Result := TPoint.Create(Trunc((Pos.X - SourceRect.P1.X) * Zoom),
    356     Trunc((Pos.Y - SourceRect.P1.Y) * Zoom));
     355  Result := TPoint.Create(Trunc((Pos.X - SourceRect.P1.X) * Zoom) + DestRect.P1.X,
     356    Trunc((Pos.Y - SourceRect.P1.Y) * Zoom) + DestRect.P1.Y);
    357357end;
    358358
     
    449449    (RectPolygon.P2.Y > RectView.P1.Y)
    450450  );
     451  Result := True;
    451452end;
    452453
  • trunk/UGeometry.pas

    r232 r234  
    5353    procedure SetEmpty;
    5454    procedure Normalize;
     55    procedure Move(P: T);
    5556    class operator Equal(const A, B: TGRect<T>): Boolean;
    5657    constructor Create(const P1, P2: T);
     
    521522end;
    522523
     524procedure TGRect<T>.Move(P: T);
     525begin
     526  P1 := P1 + P;
     527  P2 := P2 + P;
     528end;
     529
    523530constructor TGRect<T>.Create(const P1, P2: T);
    524531begin
Note: See TracChangeset for help on using the changeset viewer.