Ignore:
Timestamp:
Feb 11, 2021, 11:20:18 PM (4 years ago)
Author:
chronos
Message:
  • Added: Toggle full screen mode (F11) from View main menu.
  • Modified: Updated Common package files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r72 r79  
    2828    MenuItem3: TMenuItem;
    2929    MenuItem4: TMenuItem;
     30    MenuItem5: TMenuItem;
     31    MenuItemFullScreen: TMenuItem;
    3032    MenuItemMovesHistory: TMenuItem;
    3133    MenuItemTools: TMenuItem;
     
    4749    procedure FormPaint(Sender: TObject);
    4850    procedure FormShow(Sender: TObject);
     51    procedure MenuItemFullScreenClick(Sender: TObject);
    4952    procedure TimerDrawTimer(Sender: TObject);
    5053    procedure EraseBackground(DC: HDC); override;
     
    5659    MoveBuffer: array of TMoveDirection;
    5760    MoveBufferLock: TCriticalSection;
     61    FullScreen: Boolean;
    5862    procedure AddToMoveBuffer(Direction: TMoveDirection);
    5963    procedure ProcessMoveBuffer;
     64    procedure ToggleFullscreen;
    6065  public
    6166    MoveThread: TMoveThread;
     
    8792
    8893procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     94const
     95  KeyLeft = 37;
     96  KeyUp = 38;
     97  KeyRight = 39;
     98  KeyDown = 40;
    8999begin
    90100  if Core.Game.Running then begin
    91101    case Key of
    92       37: AddToMoveBuffer(drLeft);
    93       38: AddToMoveBuffer(drUp);
    94       39: AddToMoveBuffer(drRight);
    95       40: AddToMoveBuffer(drDown);
     102      KeyLeft: AddToMoveBuffer(drLeft);
     103      KeyUp: AddToMoveBuffer(drUp);
     104      KeyRight: AddToMoveBuffer(drRight);
     105      KeyDown: AddToMoveBuffer(drDown);
    96106    end;
    97107    //ProcessMoveBuffer;
     
    184194  Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext;
    185195  Core.PersistentForm1.Load(Self);
     196  FullScreen := Core.PersistentForm1.FormFullScreen;
    186197  Core.ThemeManager1.UseTheme(Self);
    187198  UpdateInterface;
     
    189200    InitialTileCount then
    190201    Core.Game.New;
     202end;
     203
     204procedure TFormMain.MenuItemFullScreenClick(Sender: TObject);
     205begin
     206  ToggleFullscreen;
    191207end;
    192208
     
    235251end;
    236252
     253procedure TFormMain.ToggleFullscreen;
     254begin
     255  FullScreen := not FullScreen;
     256  Core.PersistentForm1.SetFullScreen(FormMain.FullScreen);
     257  UpdateInterface;
     258end;
     259
    237260procedure TFormMain.Redraw;
    238261begin
     
    245268  ToolsVisible: Boolean;
    246269begin
     270  MenuItemFullScreen.Checked := FullScreen;
    247271  MenuItemMovesHistory.Visible := Core.Game.RecordHistory;
    248272  ToolsVisible := False;
Note: See TracChangeset for help on using the changeset viewer.