Changeset 29 for trunk/Forms


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.
Location:
trunk/Forms
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r28 r29  
    3232      end
    3333    end
     34    object MenuItemTools: TMenuItem
     35      Caption = 'Tools'
     36      object MenuItem4: TMenuItem
     37        Action = Core.AComputer
     38      end
     39    end
    3440    object MenuItemHelp: TMenuItem
    3541      Caption = 'Help'
  • trunk/Forms/UFormMain.lrj

    r28 r29  
    22{"hash":217976,"name":"tformmain.caption","sourcebytes":[50,48,52,56],"value":"2048"},
    33{"hash":317493,"name":"tformmain.menuitemgame.caption","sourcebytes":[71,97,109,101],"value":"Game"},
     4{"hash":5989939,"name":"tformmain.menuitemtools.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"},
    45{"hash":322608,"name":"tformmain.menuitemhelp.caption","sourcebytes":[72,101,108,112],"value":"Help"}
    56]}
  • 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.