Changeset 86 for trunk/Forms/FormMain.pas
- Timestamp:
- Jun 7, 2024, 12:47:11 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormMain.pas
r85 r86 1 unit UFormMain; 2 3 {$mode delphi}{$H+} 1 unit FormMain; 4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, Math, 9 ActnList, ExtCtrls, StdCtrls, UGame, PersistentForm, ApplicationInfo,10 LCLType, Syncobjs, DateUtils ;7 ActnList, ExtCtrls, StdCtrls, Game, PersistentForm, ApplicationInfo, 8 LCLType, Syncobjs, DateUtils, FormEx; 11 9 12 10 type … … 22 20 { TFormMain } 23 21 24 TFormMain = class(TForm )22 TFormMain = class(TFormEx) 25 23 MainMenu1: TMainMenu; 26 24 MenuItem1: TMenuItem; … … 72 70 FormMain: TFormMain; 73 71 72 74 73 implementation 75 74 … … 77 76 78 77 uses 79 UCore;78 Core; 80 79 81 80 { TMoveThread } … … 98 97 KeyDown = 40; 99 98 begin 100 if Core. Game.Running then begin99 if Core.Core.Game.Running then begin 101 100 case Key of 102 101 KeyLeft: AddToMoveBuffer(drLeft); … … 162 161 TimeStart := Now; 163 162 {$ENDIF} 164 Core. Game.Render(Canvas, Point(Width, Height - MainMenu1.Height));163 Core.Core.Game.Render(Canvas, Point(Width, Height - MainMenu1.Height)); 165 164 {$IFDEF DEBUG} 166 165 DrawDuration := Now - TimeStart; … … 170 169 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 171 170 begin 172 Core. PersistentForm1.Save(Self);171 Core.Core.PersistentForm1.Save(Self); 173 172 end; 174 173 175 174 procedure TFormMain.FormCreate(Sender: TObject); 176 175 begin 177 Core.Translator1.TranslateComponentRecursive(Self);178 176 MoveBufferLock := TCriticalSection.Create; 179 177 MoveThread := TMoveThread.Create(True); … … 192 190 procedure TFormMain.FormShow(Sender: TObject); 193 191 begin 194 Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext; 195 Core.PersistentForm1.Load(Self); 196 FullScreen := Core.PersistentForm1.FormFullScreen; 197 Core.ThemeManager1.UseTheme(Self); 192 FullScreen := Core.Core.PersistentForm1.FormFullScreen; 193 198 194 UpdateInterface; 199 if Core. Game.Board.GetEmptyTilesCount > Core.Game.Board.Size.X *Core.Game.Board.Size.Y -195 if Core.Core.Game.Board.GetEmptyTilesCount > Core.Core.Game.Board.Size.X * Core.Core.Game.Board.Size.Y - 200 196 InitialTileCount then 201 Core. Game.New;197 Core.Core.Game.New; 202 198 end; 203 199 … … 236 232 procedure TFormMain.ProcessMoveBuffer; 237 233 begin 238 if not Core. Game.Moving then begin234 if not Core.Core.Game.Moving then begin 239 235 MoveBufferLock.Acquire; 240 236 while Length(MoveBuffer) > 0 do begin 241 237 MoveBufferLock.Release; 242 Core. Game.MoveAllAndUpdate(MoveBuffer[0],Core.Game.AnimationDuration > 0);238 Core.Core.Game.MoveAllAndUpdate(MoveBuffer[0], Core.Core.Game.AnimationDuration > 0); 243 239 MoveBufferLock.Acquire; 244 240 if Length(MoveBuffer) > 1 then … … 254 250 begin 255 251 FullScreen := not FullScreen; 256 Core. PersistentForm1.SetFullScreen(FormMain.FullScreen);252 Core.Core.PersistentForm1.SetFullScreen(FormMain.FullScreen); 257 253 UpdateInterface; 258 254 end; … … 269 265 begin 270 266 MenuItemFullScreen.Checked := FullScreen; 271 MenuItemMovesHistory.Visible := Core. Game.RecordHistory;267 MenuItemMovesHistory.Visible := Core.Core.Game.RecordHistory; 272 268 ToolsVisible := False; 273 269 for I := 0 to MenuItemTools.Count - 1 do
Note:
See TracChangeset
for help on using the changeset viewer.