Changeset 103 for trunk/Forms/FormMain.pas
- Timestamp:
- Dec 9, 2024, 3:04:44 PM (13 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormMain.pas
r102 r103 28 28 MenuItem5: TMenuItem; 29 29 MenuItem6: TMenuItem; 30 MenuItemColorPalette: TMenuItem; 31 MenuItemTileSkin: TMenuItem; 30 32 MenuItemFullScreen: TMenuItem; 31 33 MenuItemMovesHistory: TMenuItem; … … 58 60 MoveBuffer: array of TMoveDirection; 59 61 MoveBufferLock: TCriticalSection; 62 procedure MenuItemTileSkinClick(Sender: TObject); 63 procedure MenuItemColorPaletteClick(Sender: TObject); 60 64 procedure AddToMoveBuffer(Direction: TMoveDirection); 61 65 procedure ProcessMoveBuffer; … … 179 183 180 184 procedure TFormMain.FormCreate(Sender: TObject); 185 var 186 TileSkin: TTileSkin; 187 ColorPalette: TColorPalette; 188 MenuItem: TMenuItem; 181 189 begin 182 190 MoveBufferLock := TCriticalSection.Create; … … 186 194 MoveThread.Start; 187 195 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; 188 216 end; 189 217 … … 221 249 begin 222 250 // Do nothing 251 end; 252 253 procedure TFormMain.MenuItemTileSkinClick(Sender: TObject); 254 begin 255 Core.Core.Game.Skin := TTileSkin(TMenuItem(Sender).Tag); 256 end; 257 258 procedure TFormMain.MenuItemColorPaletteClick(Sender: TObject); 259 begin 260 Core.Core.Game.ColorPalette := TColorPalette(TMenuItem(Sender).Tag); 223 261 end; 224 262 … … 277 315 end; 278 316 MenuItemTools.Visible := ToolsVisible; 317 MenuItemTileSkin.Items[Integer(Core.Core.Game.Skin)].Checked := True; 318 MenuItemColorPalette.Items[Integer(Core.Core.Game.ColorPalette)].Checked := True; 279 319 end; 280 320
Note:
See TracChangeset
for help on using the changeset viewer.