Changeset 261 for trunk/Start.pas


Ignore:
Timestamp:
Jun 11, 2020, 12:40:26 AM (4 years ago)
Author:
chronos
Message:
  • Added: Partial support for key bindings configuration.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r259 r261  
    165165
    166166uses
    167   Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UPixelPointer;
     167  Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UPixelPointer,
     168  UKeyBindings;
    168169
    169170{$R *.lfm}
     
    224225  PlayerAutoDiff: array [1 .. 5] of integer = (1, 1, 2, 2, 3);
    225226  EnemyAutoDiff: array [1 .. 5] of integer = (4, 3, 2, 1, 1);
     227  KeyBindingsFileName = 'KeyBindings.txt';
    226228
    227229{ TMiniMap }
     
    435437  PlayerSlot: TPlayerSlot;
    436438  AIBrains: TBrains;
     439  KeyBindingsAbsoluteFileName: string;
    437440begin
    438441  PlayerSlots := TPlayerSlots.Create;
     
    445448  LoadConfig;
    446449  LoadAssets;
     450  KeyBindingsAbsoluteFileName := DataDir + DirectorySeparator + KeyBindingsFileName;
     451  if FileExists(KeyBindingsAbsoluteFileName) then KeyBindings.LoadFromFile(KeyBindingsAbsoluteFileName)
     452    else begin
     453      ForceDirectories(ExtractFileDir(KeyBindingsAbsoluteFileName));
     454      KeyBindings.SaveToFile(KeyBindingsAbsoluteFileName);
     455    end;
    447456
    448457  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
     
    19631972  Shift: TShiftState);
    19641973begin
    1965   if (Shift = []) and (Key = VK_F1) then
     1974  if KeyToShortCut(Key, Shift) = BHelp.ShortCut then
    19661975    DirectHelp(cStartHelp);
    19671976end;
Note: See TracChangeset for help on using the changeset viewer.