Ignore:
Timestamp:
Dec 9, 2024, 3:04:44 PM (13 days ago)
Author:
chronos
Message:
  • Modified: Tile skin and color palette setting moved from new game dialog to menu. It can be now set during gameplay.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormMain.pas

    r102 r103  
    2828    MenuItem5: TMenuItem;
    2929    MenuItem6: TMenuItem;
     30    MenuItemColorPalette: TMenuItem;
     31    MenuItemTileSkin: TMenuItem;
    3032    MenuItemFullScreen: TMenuItem;
    3133    MenuItemMovesHistory: TMenuItem;
     
    5860    MoveBuffer: array of TMoveDirection;
    5961    MoveBufferLock: TCriticalSection;
     62    procedure MenuItemTileSkinClick(Sender: TObject);
     63    procedure MenuItemColorPaletteClick(Sender: TObject);
    6064    procedure AddToMoveBuffer(Direction: TMoveDirection);
    6165    procedure ProcessMoveBuffer;
     
    179183
    180184procedure TFormMain.FormCreate(Sender: TObject);
     185var
     186  TileSkin: TTileSkin;
     187  ColorPalette: TColorPalette;
     188  MenuItem: TMenuItem;
    181189begin
    182190  MoveBufferLock := TCriticalSection.Create;
     
    186194  MoveThread.Start;
    187195  ControlStyle := ControlStyle + [csOpaque];
     196
     197  for TileSkin := Low(SkinText) to High(SkinText) do begin
     198    MenuItem := TMenuItem.Create(MenuItemTileSkin);
     199    MenuItem.RadioItem := True;
     200    MenuItem.AutoCheck := True;
     201    MenuItem.Tag := Integer(TileSkin);
     202    MenuItem.Caption := SkinText[TileSkin];
     203    MenuItem.OnClick := MenuItemTileSkinClick;
     204    MenuItemTileSkin.Add(MenuItem);
     205  end;
     206
     207  for ColorPalette := Low(ColorPaletteText) to High(ColorPaletteText) do begin
     208    MenuItem := TMenuItem.Create(MenuItemColorPalette);
     209    MenuItem.RadioItem := True;
     210    MenuItem.AutoCheck := True;
     211    MenuItem.Tag := Integer(ColorPalette);
     212    MenuItem.Caption := ColorPaletteText[ColorPalette];
     213    MenuItem.OnClick := MenuItemColorPaletteClick;
     214    MenuItemColorPalette.Add(MenuItem);
     215  end;
    188216end;
    189217
     
    221249begin
    222250  // Do nothing
     251end;
     252
     253procedure TFormMain.MenuItemTileSkinClick(Sender: TObject);
     254begin
     255  Core.Core.Game.Skin := TTileSkin(TMenuItem(Sender).Tag);
     256end;
     257
     258procedure TFormMain.MenuItemColorPaletteClick(Sender: TObject);
     259begin
     260  Core.Core.Game.ColorPalette := TColorPalette(TMenuItem(Sender).Tag);
    223261end;
    224262
     
    277315    end;
    278316  MenuItemTools.Visible := ToolsVisible;
     317  MenuItemTileSkin.Items[Integer(Core.Core.Game.Skin)].Checked := True;
     318  MenuItemColorPalette.Items[Integer(Core.Core.Game.ColorPalette)].Checked := True;
    279319end;
    280320
Note: See TracChangeset for help on using the changeset viewer.