Ignore:
Timestamp:
Oct 6, 2019, 9:53:39 PM (5 years ago)
Author:
chronos
Message:
  • Added: Computer player accessible from Tools menu in Debug mode. It is not able to win game yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r28 r29  
    1818    MenuItem2: TMenuItem;
    1919    MenuItem3: TMenuItem;
     20    MenuItem4: TMenuItem;
     21    MenuItemTools: TMenuItem;
    2022    MenuItemNew: TMenuItem;
    2123    MenuItemExit: TMenuItem;
     
    3537  public
    3638    procedure Redraw;
     39    procedure UpdateInterface;
    3740  end;
    3841
     
    5356  if Core.Game.Running and not Core.Game.Moving then begin
    5457    case Key of
    55       37: Core.Game.MoveAll(drLeft);
    56       38: Core.Game.MoveAll(drUp);
    57       39: Core.Game.MoveAll(drRight);
    58       40: Core.Game.MoveAll(drDown);
     58      37: Core.Game.MoveAllAndUpdate(drLeft);
     59      38: Core.Game.MoveAllAndUpdate(drUp);
     60      39: Core.Game.MoveAllAndUpdate(drRight);
     61      40: Core.Game.MoveAllAndUpdate(drDown);
    5962    end;
    6063  end;
     
    8588  if not Core.Game.Running then
    8689    Core.Game.New;
     90  UpdateInterface;
    8791end;
    8892
     
    100104end;
    101105
     106procedure TFormMain.UpdateInterface;
     107var
     108  I: Integer;
     109  ToolsVisible: Boolean;
     110begin
     111  ToolsVisible := False;
     112  for I := 0 to MenuItemTools.Count - 1 do
     113    if MenuItemTools.Items[I].Enabled then begin
     114      ToolsVisible := True;
     115      Break;
     116    end;
     117  MenuItemTools.Visible := ToolsVisible;
     118end;
     119
    102120end.
    103121
Note: See TracChangeset for help on using the changeset viewer.