Changeset 63


Ignore:
Timestamp:
Jan 5, 2023, 11:03:33 PM (23 months ago)
Author:
chronos
Message:
  • Added: Snap package definition.
Location:
trunk
Files:
8 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r62 r63  
    8282        Action = AFullScreen
    8383      end
     84      object MenuItem8: TMenuItem
     85        Action = AShowRawImageDesc
     86      end
    8487    end
    8588    object MenuItem7: TMenuItem
     
    112115      OnExecute = ANewGameExecute
    113116      ShortCut = 16462
     117      Visible = False
    114118    end
    115119    object AShowMap: TAction
     
    117121      OnExecute = AShowMapExecute
    118122      ShortCut = 123
     123      Visible = False
    119124    end
    120125    object AAbout: TAction
     
    125130      Caption = 'Show RawImage Description'
    126131      OnExecute = AShowRawImageDescExecute
     132      Visible = False
    127133    end
    128134  end
  • trunk/Forms/UFormMain.pas

    r62 r63  
    3131    MenuItem6: TMenuItem;
    3232    MenuItem7: TMenuItem;
     33    MenuItem8: TMenuItem;
    3334    MenuItem9: TMenuItem;
    3435    StatusBar1: TStatusBar;
     
    137138  {$IFDEF DEBUG}
    138139  StatusBar1.Visible := not FullScreenEnabled;
     140  AShowMap.Visible := True;
     141  ANewGame.Visible := True;
     142  AShowRawImageDesc.Visible := True;
    139143  {$ENDIF}
    140144end;
     
    148152begin
    149153  XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml';
     154  FullScreenEnabled := True;
    150155
    151156  PersistentForm := TPersistentForm.Create(nil);
     
    244249  PersistentForm.Load(Self, False, True);
    245250  FullScreenEnabled := PersistentForm.FormFullScreen;
    246   UpdateInterface
     251  PersistentForm.SetFullScreen(FullScreenEnabled);
     252  UpdateInterface;
    247253end;
    248254
  • trunk/Install/deb/debian/control

    r37 r63  
    99Architecture: any
    1010Depends: ${shlibs:Depends}, ${misc:Depends},
    11 Description: Real-time digging tank battle game
     11Description: A real-time digging and shooting multi-player tank battle game
    1212HomePage: https://app.zdechov.net/Tunneler
  • trunk/Install/deb/debian/rules

    r35 r63  
    1717        install -s -m 755 Tunneler $(ROOT)/usr/bin
    1818        install -d -m 755 $(ROOT)/usr/share/applications
    19         install -m 755 Install/deb/Tunneler.desktop $(ROOT)/usr/share/applications
     19        install -m 755 Install/common/Tunneler.desktop $(ROOT)/usr/share/applications
    2020        install -d -m 755 $(ROOT)/usr/share/pixmaps
    2121        install -m 644 Images/64x64/Tunneler.png $(ROOT)/usr/share/pixmaps
    22         install -d -m 755 $(ROOT)/usr/share/Tunneler/languages
    23         install -D -m 755 Languages/* $(ROOT)/usr/share/Tunneler/languages
     22        install -d -m 755 $(ROOT)/usr/share/Tunneler/Languages
     23        install -D -m 755 Languages/*.pot $(ROOT)/usr/share/Tunneler/Languages
     24        install -D -m 755 Languages/*.po $(ROOT)/usr/share/Tunneler/Languages
    2425       
    2526%:
  • trunk/Packages/Common/UGeometric.pas

    r54 r63  
    99  TPointArray = array of TPoint;
    1010
     11  { TVector }
     12
     13  TVector = record
     14    Position: TPoint;
     15    Direction: TPoint;
     16    function GetLength: Integer;
     17    function GetAngle: Double;
     18  end;
     19
    1120function Distance(P1, P2: TPoint): Integer;
    1221function Dot(const P1, P2: TPoint): Double;
    1322function AddPoint(const P1, P2: TPoint): TPoint;
    1423function SubPoint(const P1, P2: TPoint): TPoint;
    15 function PointToLineDistance(const P, V, W: TPoint): Integer;
     24function PointToLineDistance(const P, V, W: TPoint; out Intersect: TPoint): Integer;
    1625function ComparePoint(P1, P2: TPoint): Boolean;
    1726function RotatePoint(Center, P: TPoint; Angle: Double): TPoint;
     
    5059end;
    5160
    52 function PointToLineDistance(const P, V, W: TPoint): Integer;
     61function PointToLineDistance(const P, V, W: TPoint; out Intersect: TPoint): Integer;
    5362var
    5463  l2, t: Double;
     
    6877  if T < 0 then begin
    6978    Result := Distance(P, V);       // Beyond the 'v' end of the segment
    70     exit;
     79    Intersect := V;
     80    Exit;
    7181  end
    7282  else if T > 1 then begin
    7383    Result := Distance(P, W);  // Beyond the 'w' end of the segment
     84    Intersect := W;
    7485    Exit;
    7586  end;
     
    7788  TT.Y := Trunc(V.Y + T * (W.Y - V.Y));
    7889  Result := Distance(P, TT);
     90  Intersect := TT;
    7991end;
    8092
     
    162174end;
    163175
     176{ TVector }
     177
     178function TVector.GetLength: Integer;
     179begin
     180  Result := Trunc(Sqrt(Sqr(Direction.X) + Sqr(Direction.Y)));
     181end;
     182
     183function TVector.GetAngle: Double;
     184begin
     185  Result := ArcTan2(Direction.Y, Direction.X);
     186end;
    164187
    165188end.
  • trunk/Packages/Common/UPersistentForm.pas

    r54 r63  
    11unit UPersistentForm;
    2 
    3 // Date: 2020-11-26
    42
    53interface
     
    2119    procedure SaveControl(Control: TControl);
    2220  public
    23     FormNormalSize: TRect;
    2421    FormRestoredSize: TRect;
    2522    FormWindowState: TWindowState;
     
    155152    RootKey := RegistryContext.RootKey;
    156153    OpenKey(RegistryContext.Key + '\Forms\' + Form.Name, True);
    157     // Normal size
    158     FormNormalSize.Left := ReadIntegerWithDefault('NormalLeft', FormNormalSize.Left);
    159     FormNormalSize.Top := ReadIntegerWithDefault('NormalTop', FormNormalSize.Top);
    160     FormNormalSize.Right := ReadIntegerWithDefault('NormalWidth', FormNormalSize.Right - FormNormalSize.Left)
    161       + FormNormalSize.Left;
    162     FormNormalSize.Bottom := ReadIntegerWithDefault('NormalHeight', FormNormalSize.Bottom - FormNormalSize.Top)
    163       + FormNormalSize.Top;
     154
    164155    // Restored size
    165156    FormRestoredSize.Left := ReadIntegerWithDefault('RestoredLeft', FormRestoredSize.Left);
     
    169160    FormRestoredSize.Bottom := ReadIntegerWithDefault('RestoredHeight', FormRestoredSize.Bottom - FormRestoredSize.Top)
    170161      + FormRestoredSize.Top;
     162
    171163    // Other state
    172164    FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(FormWindowState)));
     
    183175    RootKey := RegistryContext.RootKey;
    184176    OpenKey(RegistryContext.Key + '\Forms\' + Form.Name, True);
    185     // Normal state
    186     WriteInteger('NormalWidth', FormNormalSize.Right - FormNormalSize.Left);
    187     WriteInteger('NormalHeight', FormNormalSize.Bottom - FormNormalSize.Top);
    188     WriteInteger('NormalTop', FormNormalSize.Top);
    189     WriteInteger('NormalLeft', FormNormalSize.Left);
    190     // Restored state
     177
     178    // Restored size
    191179    WriteInteger('RestoredWidth', FormRestoredSize.Right - FormRestoredSize.Left);
    192180    WriteInteger('RestoredHeight', FormRestoredSize.Bottom - FormRestoredSize.Top);
    193181    WriteInteger('RestoredTop', FormRestoredSize.Top);
    194182    WriteInteger('RestoredLeft', FormRestoredSize.Left);
     183
    195184    // Other state
    196185    WriteInteger('WindowState', Integer(FormWindowState));
     
    257246begin
    258247  Self.Form := Form;
     248
    259249  // Set default
    260   FormNormalSize := Bounds((Screen.Width - Form.Width) div 2,
    261     (Screen.Height - Form.Height) div 2, Form.Width, Form.Height);
    262250  FormRestoredSize := Bounds((Screen.Width - Form.Width) div 2,
    263251    (Screen.Height - Form.Height) div 2, Form.Width, Form.Height);
     
    267255  LoadFromRegistry(RegistryContext);
    268256
    269   if not EqualRect(FormNormalSize, FormRestoredSize) or
    270     DefaultMaximized then begin
     257  if (FormWindowState = wsMaximized) or DefaultMaximized then begin
    271258    // Restore to maximized state
    272259    Form.WindowState := wsNormal;
     
    277264    // Restore to normal state
    278265    Form.WindowState := wsNormal;
    279     if FEntireVisible then FormNormalSize := CheckEntireVisible(FormNormalSize)
     266    if FEntireVisible then FormRestoredSize := CheckEntireVisible(FormRestoredSize)
    280267      else if FMinVisiblePart > 0 then
    281     FormNormalSize := CheckPartVisible(FormNormalSize, FMinVisiblePart);
    282     if not EqualRect(FormNormalSize, Form.BoundsRect) then
    283       Form.BoundsRect := FormNormalSize;
     268        FormRestoredSize := CheckPartVisible(FormRestoredSize, FMinVisiblePart);
     269    if not EqualRect(FormRestoredSize, Form.BoundsRect) then
     270      Form.BoundsRect := FormRestoredSize;
    284271  end;
    285272  if FormFullScreen then SetFullScreen(True);
     
    290277begin
    291278  Self.Form := Form;
    292   FormNormalSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height);
    293   if not FormFullScreen then
    294     FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
    295       Form.RestoredHeight);
    296   FormWindowState := Form.WindowState;
     279  if not FormFullScreen then begin
     280    FormWindowState := Form.WindowState;
     281    if FormWindowState = wsMaximized then begin
     282      FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
     283        Form.RestoredHeight);
     284    end else
     285    if FormWindowState = wsNormal then begin
     286      FormRestoredSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height);
     287    end;
     288  end;
    297289  SaveToRegistry(RegistryContext);
    298290  SaveControl(Form);
     
    312304  if State then begin
    313305    FormFullScreen := True;
    314     FormNormalSize := Form.BoundsRect;
    315     FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
    316       Form.RestoredHeight);
     306    if Form.WindowState = wsMaximized then begin
     307      FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
     308        Form.RestoredHeight);
     309    end else
     310    if Form.WindowState = wsNormal then begin
     311      FormRestoredSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height);
     312    end;
    317313    FormWindowState := Form.WindowState;
     314    Form.WindowState := wsMaximized;
     315    Form.WindowState := wsNormal;
    318316    ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);
    319317    {$IFDEF WINDOWS}
     
    327325    ShowWindow(Form.Handle, SW_SHOWNORMAL);
    328326    if FormWindowState = wsNormal then begin
    329       Form.BoundsRect := FormNormalSize;
     327      Form.WindowState := wsNormal;
     328      Form.BoundsRect := FormRestoredSize;
    330329    end else
    331330    if FormWindowState = wsMaximized then begin
  • trunk/tunneler.lpi

    r62 r63  
    5050            <Debugging>
    5151              <GenerateDebugInfo Value="False"/>
     52              <DebugInfoType Value="dsDwarf2Set"/>
    5253              <UseLineInfoUnit Value="False"/>
    5354            </Debugging>
Note: See TracChangeset for help on using the changeset viewer.