Changeset 79 for trunk/Forms


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

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r72 r79  
    1818  LCLVersion = '2.0.10.0'
    1919  object MainMenu1: TMainMenu
    20     Left = 325
     20    Left = 328
    2121    Top = 152
    2222    object MenuItemGame: TMenuItem
     
    3333      object MenuItemExit: TMenuItem
    3434        Action = Core.AExit
     35      end
     36    end
     37    object MenuItem5: TMenuItem
     38      Caption = 'View'
     39      object MenuItemFullScreen: TMenuItem
     40        Caption = 'Full screen'
     41        ShortCut = 122
     42        OnClick = MenuItemFullScreenClick
    3543      end
    3644    end
  • trunk/Forms/UFormMain.lrj

    r72 r79  
    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":380871,"name":"tformmain.menuitem5.caption","sourcebytes":[86,105,101,119],"value":"View"},
     5{"hash":131549534,"name":"tformmain.menuitemfullscreen.caption","sourcebytes":[70,117,108,108,32,115,99,114,101,101,110],"value":"Full screen"},
    46{"hash":5989939,"name":"tformmain.menuitemtools.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"},
    57{"hash":322608,"name":"tformmain.menuitemhelp.caption","sourcebytes":[72,101,108,112],"value":"Help"}
  • 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;
  • trunk/Forms/UFormNew.lfm

    r49 r79  
    1111  OnCreate = FormCreate
    1212  OnShow = FormShow
    13   LCLVersion = '2.0.2.0'
     13  LCLVersion = '2.0.10.0'
    1414  object Label1: TLabel
    1515    Left = 16
    16     Height = 26
     16    Height = 24
    1717    Top = 16
    1818    Width = 93
     
    7474    Height = 30
    7575    Top = 88
    76     Width = 210
     76    Width = 209
    7777    Caption = 'Record moves history'
    7878    TabOrder = 4
     
    8080  object Label2: TLabel
    8181    Left = 16
    82     Height = 26
     82    Height = 24
    8383    Top = 125
    8484    Width = 75
     
    8888  object ComboBoxSkin: TComboBox
    8989    Left = 173
    90     Height = 38
     90    Height = 37
    9191    Top = 120
    9292    Width = 262
Note: See TracChangeset for help on using the changeset viewer.