Changeset 68 for trunk


Ignore:
Timestamp:
Sep 28, 2014, 2:36:03 PM (10 years ago)
Author:
chronos
Message:
  • Added: Option to change animation speed.
  • Fixed: Shifted view during computer turn.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormSettings.lfm

    r55 r68  
    2929  object Label1: TLabel
    3030    Left = 20
    31     Height = 25
     31    Height = 22
    3232    Top = 26
    33     Width = 95
     33    Width = 80
    3434    Caption = 'Language:'
    3535    ParentColor = False
     
    3737  object ComboBoxLanguage: TComboBox
    3838    Left = 178
    39     Height = 37
     39    Height = 34
    4040    Top = 24
    4141    Width = 196
     
    4646  object CheckBoxDevelMode: TCheckBox
    4747    Left = 16
    48     Height = 27
     48    Height = 24
    4949    Top = 80
    50     Width = 176
     50    Width = 157
    5151    Caption = 'Developer mode'
    5252    TabOrder = 3
    5353  end
     54  object SpinEditAnimSpeed: TSpinEdit
     55    Left = 184
     56    Height = 32
     57    Top = 120
     58    Width = 122
     59    TabOrder = 4
     60  end
     61  object Label2: TLabel
     62    Left = 19
     63    Height = 22
     64    Top = 126
     65    Width = 140
     66    Caption = 'Animation speed:'
     67    ParentColor = False
     68  end
     69  object Label3: TLabel
     70    Left = 311
     71    Height = 22
     72    Top = 128
     73    Width = 15
     74    Caption = '%'
     75    ParentColor = False
     76  end
    5477end
  • trunk/Forms/UFormSettings.lrt

    r55 r68  
    44TFORMSETTINGS.LABEL1.CAPTION=Language:
    55TFORMSETTINGS.CHECKBOXDEVELMODE.CAPTION=Developer mode
     6TFORMSETTINGS.LABEL2.CAPTION=Animation speed:
     7TFORMSETTINGS.LABEL3.CAPTION=%
  • trunk/Forms/UFormSettings.pas

    r55 r68  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
     8  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
     9  Spin;
    910
    1011type
     
    1819    ComboBoxLanguage: TComboBox;
    1920    Label1: TLabel;
     21    Label2: TLabel;
     22    Label3: TLabel;
     23    SpinEditAnimSpeed: TSpinEdit;
    2024  private
    2125    { private declarations }
     
    4044begin
    4145  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    42    ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
    43    if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    44    CheckBoxDevelMode.Checked := Core.DevelMode;
     46  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     47  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     48  CheckBoxDevelMode.Checked := Core.DevelMode;
     49  SpinEditAnimSpeed.Value := Core.AnimationSpeed;
    4550end;
    4651
     
    5055    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    5156  Core.DevelMode := CheckBoxDevelMode.Checked;
     57  Core.AnimationSpeed := SpinEditAnimSpeed.Value;
    5258end;
    5359
  • trunk/Languages/xtactics.cs.po

    r64 r68  
    355355msgstr "Jazyk:"
    356356
     357#: tformsettings.label2.caption
     358msgid "Animation speed:"
     359msgstr ""
     360
     361#: tformsettings.label3.caption
     362#, fuzzy
     363msgctxt "tformsettings.label3.caption"
     364msgid "%"
     365msgstr "%"
     366
    357367#: ucore.sendgame
    358368msgid "End game?"
  • trunk/Languages/xtactics.po

    r64 r68  
    343343msgstr ""
    344344
     345#: tformsettings.label2.caption
     346msgid "Animation speed:"
     347msgstr ""
     348
     349#: tformsettings.label3.caption
     350msgctxt "TFORMSETTINGS.LABEL3.CAPTION"
     351msgid "%"
     352msgstr ""
     353
    345354#: ucore.sendgame
    346355msgid "End game?"
  • trunk/UCore.pas

    r65 r68  
    4848      CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);
    4949    procedure DoOnWin(Player: TPlayer);
     50    procedure Delay(Time: Integer);
    5051  public
    5152    Game: TGame;
     
    5354    DevelMode: Boolean;
    5455    LastMapFileName: string;
    55     View: TView;
     56    AnimationSpeed: Integer;
    5657    procedure UpdateActions;
    5758    procedure Init;
     
    106107end;
    107108
     109procedure TCore.Delay(Time: Integer);
     110var
     111  I: Integer;
     112const
     113  Slice = 50; // ms
     114begin
     115  while Time > 0 do begin
     116    Application.ProcessMessages;
     117    if Time > Slice then Sleep(Slice) else Sleep(Time);
     118    Dec(Time, Slice);
     119  end;
     120end;
     121
    108122procedure TCore.UpdateActions;
    109123begin
     
    146160      Computer.Free;
    147161      FormMain.Redraw;
    148       for I := 0 to 10 do begin
    149         Application.ProcessMessages;
    150         Sleep(100);
    151       end;
     162      Delay(Trunc((100 - AnimationSpeed) / 100 * 2000));
    152163    end;
    153164    Game.NextTurn;
     
    232243  XMLConfig1.SetValue('LastMapFileName', LastMapFileName);
    233244  XMLConfig1.SetValue('DevelMode', DevelMode);
     245  XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed);
    234246  FreeAndNil(Game);
    235247end;
     
    242254  LastMapFileName := XMLConfig1.GetValue('LastMapFileName', '');
    243255  DevelMode := XMLConfig1.GetValue('DevelMode', false);
     256  AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50);
    244257  CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', ''));
    245258  for I := 0 to Game.Players.Count - 1 do
  • trunk/UGame.pas

    r67 r68  
    10921092begin
    10931093  SourceRect := Source.SourceRect;
    1094   DestRect := Source.DestRect;
    1095   Zoom := Source.Zoom;
     1094  FDestRect := Source.DestRect;
     1095  FZoom := Source.Zoom;
    10961096  SelectedCell := Source.SelectedCell;
    10971097  FocusedCell := Source.FocusedCell;
  • trunk/xtactics.lpi

    r66 r68  
    118118        <HasResources Value="True"/>
    119119        <ResourceBaseClass Value="Form"/>
     120        <UnitName Value="UFormSettings"/>
    120121      </Unit4>
    121122      <Unit5>
Note: See TracChangeset for help on using the changeset viewer.