Changeset 414 for trunk/Forms


Ignore:
Timestamp:
Jan 10, 2025, 4:24:19 PM (12 days ago)
Author:
chronos
Message:
  • Modified: Lowered idle CPU consumption.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormClient.pas

    r404 r414  
    320320  if RedrawPending and not Drawing then begin
    321321    Drawing := True;
    322     if not Core.Core.DevelMode then RedrawPending := False;
     322    RedrawPending := False;
     323    Timer1.Enabled := False;
    323324    TimerPeriod := (9 * TimerPeriod + (Now - LastTimerTime)) / 10;
    324325    LastTimerTime := Now;
     
    358359begin
    359360  Redraw;
     361  Core.Core.FormMain.UpdateInterface;
    360362end;
    361363
     
    421423begin
    422424  RedrawPending := True;
     425  Timer1.Enabled := True;
    423426end;
    424427
  • trunk/Forms/FormMain.lfm

    r364 r414  
    11object FormMain: TFormMain
    22  Left = 534
    3   Height = 959
     3  Height = 925
    44  Top = 223
    55  Width = 1491
    66  Caption = 'xTactics'
    7   ClientHeight = 959
     7  ClientHeight = 925
    88  ClientWidth = 1491
    99  DesignTimePPI = 144
     
    9797  object PanelMain: TPanel
    9898    Left = 0
    99     Height = 919
     99    Height = 885
    100100    Top = 40
    101101    Width = 1491
     
    107107  object MainMenu1: TMainMenu
    108108    Images = Core.ImageListSmall
    109     Left = 224
    110     Top = 48
     109    Left = 88
     110    Top = 112
    111111    object MenuItem1: TMenuItem
    112112      Caption = 'Game'
     
    233233    end
    234234  end
    235   object Timer1: TTimer
    236     Interval = 20
    237     OnTimer = Timer1Timer
    238     Left = 128
    239     Top = 263
    240   end
    241235  object ActionList1: TActionList
    242236    Images = Core.ImageListSmall
    243     Left = 280
    244     Top = 152
     237    Left = 88
     238    Top = 184
    245239    object AToolBarBigIcons: TAction
    246240      Caption = 'Toolbar big icons'
     
    265259  end
    266260  object PopupMenuToolbar: TPopupMenu
    267     Left = 452
    268     Top = 98
     261    Left = 432
     262    Top = 112
    269263    object MenuItem18: TMenuItem
    270264      Action = AToolBarBigIcons
     
    272266  end
    273267  object PopupMenuOpenRecent: TPopupMenu
    274     Left = 448
    275     Top = 251
     268    Left = 432
     269    Top = 184
    276270  end
    277271end
  • trunk/Forms/FormMain.pas

    r364 r414  
    6767    PopupMenuToolbar: TPopupMenu;
    6868    Separator1: TMenuItem;
    69     Timer1: TTimer;
    7069    ToolBar1: TToolBar;
    7170    ToolButton1: TToolButton;
     
    9493    procedure FormDestroy(Sender: TObject);
    9594    procedure EraseBackground(DC: HDC); override;
    96     procedure Timer1Timer(Sender: TObject);
    9795  private
    9896    FormActivated: Boolean;
     
    106104    FormUnitMoves: TFormUnitMoves;
    107105    FormCharts: TFormCharts;
     106    procedure UpdateInterface;
    108107    procedure LoadConfig(Config: TXmlConfig; Path: string);
    109108    procedure SaveConfig(Config: TXmlConfig; Path: string);
     
    128127begin
    129128  // Do nothing, all background space covered by controls
    130 end;
    131 
    132 procedure TFormMain.Timer1Timer(Sender: TObject);
    133 var
    134   NewCaption: string;
    135 begin
    136   NewCaption := 'xTactics';
    137   if Assigned(Core.Core.Game.CurrentPlayer) then
    138     NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' +
    139     IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption;
    140   Caption := NewCaption;
    141129end;
    142130
     
    311299end;
    312300
     301procedure TFormMain.UpdateInterface;
     302var
     303  NewCaption: string;
     304begin
     305  NewCaption := 'xTactics';
     306  if Assigned(Core.Core.Game.CurrentPlayer) then
     307    NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' +
     308    IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption;
     309  Caption := NewCaption;
     310end;
     311
    313312procedure TFormMain.FormShow(Sender: TObject);
    314313begin
Note: See TracChangeset for help on using the changeset viewer.