Ignore:
Timestamp:
Jun 7, 2024, 12:47:11 PM (3 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Used TFormEx for all forms for code simplification.
  • Fixed: Fullscreen mode switching error.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormMain.pas

    r85 r86  
    1 unit UFormMain;
    2 
    3 {$mode delphi}{$H+}
     1unit FormMain;
    42
    53interface
     
    75uses
    86  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;
    119
    1210type
     
    2220  { TFormMain }
    2321
    24   TFormMain = class(TForm)
     22  TFormMain = class(TFormEx)
    2523    MainMenu1: TMainMenu;
    2624    MenuItem1: TMenuItem;
     
    7270  FormMain: TFormMain;
    7371
     72
    7473implementation
    7574
     
    7776
    7877uses
    79   UCore;
     78  Core;
    8079
    8180{ TMoveThread }
     
    9897  KeyDown = 40;
    9998begin
    100   if Core.Game.Running then begin
     99  if Core.Core.Game.Running then begin
    101100    case Key of
    102101      KeyLeft: AddToMoveBuffer(drLeft);
     
    162161  TimeStart := Now;
    163162  {$ENDIF}
    164   Core.Game.Render(Canvas, Point(Width, Height - MainMenu1.Height));
     163  Core.Core.Game.Render(Canvas, Point(Width, Height - MainMenu1.Height));
    165164  {$IFDEF DEBUG}
    166165  DrawDuration := Now - TimeStart;
     
    170169procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    171170begin
    172   Core.PersistentForm1.Save(Self);
     171  Core.Core.PersistentForm1.Save(Self);
    173172end;
    174173
    175174procedure TFormMain.FormCreate(Sender: TObject);
    176175begin
    177   Core.Translator1.TranslateComponentRecursive(Self);
    178176  MoveBufferLock := TCriticalSection.Create;
    179177  MoveThread := TMoveThread.Create(True);
     
    192190procedure TFormMain.FormShow(Sender: TObject);
    193191begin
    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
    198194  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 -
    200196    InitialTileCount then
    201     Core.Game.New;
     197    Core.Core.Game.New;
    202198end;
    203199
     
    236232procedure TFormMain.ProcessMoveBuffer;
    237233begin
    238   if not Core.Game.Moving then begin
     234  if not Core.Core.Game.Moving then begin
    239235    MoveBufferLock.Acquire;
    240236    while Length(MoveBuffer) > 0 do begin
    241237      MoveBufferLock.Release;
    242       Core.Game.MoveAllAndUpdate(MoveBuffer[0], Core.Game.AnimationDuration > 0);
     238      Core.Core.Game.MoveAllAndUpdate(MoveBuffer[0], Core.Core.Game.AnimationDuration > 0);
    243239      MoveBufferLock.Acquire;
    244240      if Length(MoveBuffer) > 1 then
     
    254250begin
    255251  FullScreen := not FullScreen;
    256   Core.PersistentForm1.SetFullScreen(FormMain.FullScreen);
     252  Core.Core.PersistentForm1.SetFullScreen(FormMain.FullScreen);
    257253  UpdateInterface;
    258254end;
     
    269265begin
    270266  MenuItemFullScreen.Checked := FullScreen;
    271   MenuItemMovesHistory.Visible := Core.Game.RecordHistory;
     267  MenuItemMovesHistory.Visible := Core.Core.Game.RecordHistory;
    272268  ToolsVisible := False;
    273269  for I := 0 to MenuItemTools.Count - 1 do
Note: See TracChangeset for help on using the changeset viewer.