Changeset 293 for trunk/LocalPlayer


Ignore:
Timestamp:
Mar 5, 2021, 1:36:47 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Apply settings from settings dialog only after Ok button click.
  • Fixed: Improved full screen mode switching. F11 key can be used in game client form.
Location:
trunk/LocalPlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r292 r293  
    235235    Closable, RepaintOnResize, Tracking, TurnComplete, Edited, GoOnPhase,
    236236      HaveStrategyAdvice, FirstMovieTurn: boolean;
     237    PrevWindowState: TWindowState;
     238    CurrentWindowState: TWindowState;
    237239    function ChooseUnusedTribe: integer;
    238240    procedure GetTribeList;
     
    284286    procedure SoundPreload(Check: integer);
    285287    procedure UpdateKeyShortcuts;
     288    procedure SetFullScreen(Active: Boolean);
    286289  public
    287290    UsedOffscreenWidth, UsedOffscreenHeight: integer;
     
    308311    FileName: ShortString;
    309312  end;
    310 
    311313  TCityNameInfo = record
    312314    ID: integer;
    313     NewName: ShortString end;
    314     TModelNameInfo = record mix: integer;
    315     NewName: ShortString end;
    316     TPriceSet = Set of $00 .. $FF;
     315    NewName: ShortString;
     316  end;
     317  TModelNameInfo = record
     318    mix: integer;
     319    NewName: ShortString;
     320  end;
     321  TPriceSet = Set of $00 .. $FF;
    317322
    318323const
     
    532537  SmallScreen, GameOK, MapValid, skipped, idle: boolean;
    533538
    534   SaveOption: array [0 .. nSaveOption - 1] of integer;
    535   MiniColors: array [0 .. 11, 0 .. 1] of TColor;
     539  SaveOption: array [0..nSaveOption - 1] of integer;
     540  MiniColors: array [0..11, 0..1] of TColor;
    536541  MainMap: TIsoMap;
    537542  CurrentMoveInfo: record AfterMovePaintRadius, AfterAttackExpeller: integer;
     
    737742    ChooseModelPicture(Owner, mix, ModelCode(MyRO.EnemyModel[emix]),
    738743      ModelHash(MyRO.EnemyModel[emix]), MyRO.Turn, false, true);
    739   result := true
     744  result := true;
    740745end;
    741746
     
    874879            MyModel[mix].Status := MyModel[mix].Status or msObsolete;
    875880      end;
    876       inc(MyData.ToldModels)
     881      inc(MyData.ToldModels);
    877882    end;
    878883end;
     
    36123617    RectInvalidate(0, TopBarHeight, ClientWidth, TopBarHeight + MapHeight);
    36133618    MapValid := false;
    3614     PaintAll
    3615   end
     3619    PaintAll;
     3620  end;
    36163621end;
    36173622
     
    40584063var
    40594064  uix, cix, x, y, Loc, i, hw, xm, cm, cmPolOcean, cmPolNone: integer;
    4060   PrevMiniPixel, MiniPixel: TPixelPointer;
     4065  PrevMiniPixel: TPixelPointer;
     4066  MiniPixel: TPixelPointer;
     4067  TerrainTile: Cardinal;
    40614068begin
    40624069  cmPolOcean := GrExt[HGrSystem].Data.Canvas.Pixels[101, 67];
     
    40824089            ScaleToNative(G.lx) * 5) mod (ScaleToNative(G.lx) * 2);
    40834090          MiniPixel.SetXY(xm, y);
    4084           cm := MiniColors[MyMap[Loc] and fTerrain, i];
     4091          TerrainTile := MyMap[Loc] and fTerrain;
     4092          if TerrainTile > 11 then TerrainTile := 0;
     4093          cm := MiniColors[TerrainTile, i];
    40854094          if ClientMode = cEditMap then
    40864095          begin
     
    45724581      Brush.Style := bsClear;
    45734582      if UnFocus >= 0 then
    4574         with MyUn[UnFocus], MyModel[mix] do
     4583        with MyUn[UnFocus] do
     4584        with MyModel[mix] do
    45754585        begin { display info about selected unit }
    45764586          if Job = jCity then
     
    64926502end;
    64936503
     6504procedure TMainScreen.SetFullScreen(Active: Boolean);
     6505begin
     6506  (*  if FullScreen then begin
     6507      ShowWindow(Handle, SW_SHOWFULLSCREEN);
     6508      {$IFDEF WINDOWS}
     6509      Form.BorderStyle := bsNone;
     6510      {$ENDIF}
     6511    end else begin
     6512      {$IFDEF WINDOWS}
     6513      Form.BorderStyle := bsSizeable;
     6514      {$ENDIF}
     6515      ShowWindow(Handle, SW_SHOWNORMAL);
     6516      WindowState := wsMaximized;
     6517      BorderStyle := bsSizeable;
     6518      BorderIcons := [biSystemMenu, biMinimize, biMaximize];
     6519    end;
     6520   *)
     6521    if Active and (CurrentWindowState <> wsFullScreen) then begin
     6522      PrevWindowState := WindowState;
     6523      CurrentWindowState := wsFullScreen;
     6524      WindowState := CurrentWindowState;
     6525      {$IFDEF WINDOWS}
     6526      BorderStyle := bsNone;
     6527      {$ENDIF}
     6528      BorderIcons := [];
     6529    end else
     6530    if not Active and (CurrentWindowState = wsFullScreen) then begin
     6531      if PrevWindowState = wsMaximized then begin
     6532        CurrentWindowState := wsMaximized;
     6533        WindowState := CurrentWindowState;
     6534      end else begin
     6535        CurrentWindowState := wsNormal;
     6536        WindowState := CurrentWindowState;
     6537        WindowState := wsFullScreen;
     6538        WindowState := CurrentWindowState;
     6539      end;
     6540      {$IFDEF WINDOWS}
     6541      BorderStyle := bsSizeable;
     6542      {$ENDIF}
     6543      BorderIcons := [biSystemMenu, biMinimize, biMaximize];
     6544    end;
     6545end;
     6546
    64946547procedure TMainScreen.FormKeyDown(Sender: TObject; var Key: word;
    64956548  Shift: TShiftState);
     
    65586611
    65596612  if BEndTurn.Test(ShortCut) then EndTurn
     6613  else if BFullScreen.Test(ShortCut) then begin
     6614    FullScreen := not FullScreen;
     6615    SetFullScreen(FullScreen);
     6616  end
    65606617  else if BHelp.Test(ShortCut) then MenuClick(mHelp)
    65616618  else if BUnitStat.Test(ShortCut) then MenuClick_Check(StatPopup, mUnitStat)
     
    77587815procedure TMainScreen.FormShow(Sender: TObject);
    77597816begin
    7760   if FullScreen then begin
    7761     WindowState := wsFullScreen;
    7762     BorderStyle := bsNone;
    7763     BorderIcons := [];
    7764   end else begin
    7765     WindowState := wsMaximized;
    7766     BorderStyle := bsSizeable;
    7767     BorderIcons := [biSystemMenu, biMinimize, biMaximize];
    7768   end;
     7817  SetFullScreen(FullScreen);
    77697818  Timer1.Enabled := True;
    77707819end;
  • trunk/LocalPlayer/UKeyBindings.pas

    r292 r293  
    4444  BNations: TKeyBinding;
    4545  BEmpire: TKeyBinding;
     46  BFullScreen: TKeyBinding;
    4647  BResign: TKeyBinding;
    4748  BRandomMap: TKeyBinding;
     
    222223  BNations := AddItem('Nations', 'Nations', 'F9');
    223224  BEmpire := AddItem('Empire', 'Empire', 'F10');
     225  BFullScreen := AddItem('FullScreen', 'Full screen', 'F11');
    224226  BResign := AddItem('Resign', 'Resign', 'Ctrl+Q');
    225227  BRandomMap := AddItem('RandomMap', 'Random map', 'Ctrl+R');
Note: See TracChangeset for help on using the changeset viewer.