Changeset 250 for trunk/UCore.pas


Ignore:
Timestamp:
Sep 22, 2018, 10:11:33 PM (6 years ago)
Author:
chronos
Message:
  • Added: Full screen mode.
  • Added: Icon for keyboard shortcut.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r249 r250  
    1717  TCore = class(TDataModule)
    1818    AAbout: TAction;
     19    AFullscreen: TAction;
    1920    AToggleFogOfWar: TAction;
    2021    AShowKeyShortcuts: TAction;
     
    4647    procedure AAboutExecute(Sender: TObject);
    4748    procedure AExitExecute(Sender: TObject);
     49    procedure AFullscreenExecute(Sender: TObject);
    4850    procedure AGameEndExecute(Sender: TObject);
    4951    procedure AGameLoadExecute(Sender: TObject);
     
    7072    GameLoaded: Boolean;
    7173    FormNewTabIndex: Integer;
     74    OldWindowState: TWindowState;
     75    InFullScreenMode: Boolean;
    7276    procedure LoadRecentExecute(Sender: TObject);
    7377    procedure StartNewGame;
     
    273277end;
    274278
     279procedure TCore.AFullscreenExecute(Sender: TObject);
     280begin
     281  if InFullScreenMode then begin
     282    // Workaround: WindowState has sometimes wrong value under Linux.
     283    // Try to switch fullscreen again before switching back.
     284    if FormMain.WindowState <> wsFullScreen then begin
     285      FormMain.WindowState := wsFullScreen;
     286    end;
     287    FormMain.WindowState := OldWindowState;
     288    InFullScreenMode := False;
     289  end else begin
     290    OldWindowState := FormMain.WindowState;
     291    FormMain.WindowState := wsFullScreen;
     292    InFullScreenMode := True;
     293  end;
     294end;
     295
    275296procedure TCore.AAboutExecute(Sender: TObject);
    276297begin
Note: See TracChangeset for help on using the changeset viewer.