Changeset 90 for trunk/Forms


Ignore:
Timestamp:
Nov 16, 2014, 5:12:25 PM (10 years ago)
Author:
chronos
Message:
  • Added: Computer player settings to be low, medium or highly aggresive in attacking.
  • Fixed: Mouse move insensitivity zone is now DPI aware.
Location:
trunk/Forms
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r87 r90  
    1111const
    1212  ZoomFactor = 1.5;
    13   MouseMinDiff = 6;
     13  MouseMinDiff = 0.1;
    1414
    1515type
     
    359359  if Assigned(Core.Game.CurrentPlayer) then begin
    360360    if MoveActive then
    361     if (Abs(StartMousePoint.X - X) > MouseMinDiff) or (Abs(StartMousePoint.Y - Y) > MouseMinDiff) then
     361    if (Abs(StartMousePoint.X - X) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) or
     362    (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then
    362363    with Core.Game.CurrentPlayer do begin
    363364      if Mode = pmHuman then begin
     
    390391  Shift: TShiftState; X, Y: Integer);
    391392begin
    392   if (Abs(StartMousePoint.X - X) < MouseMinDiff) and (Abs(StartMousePoint.Y - Y) < MouseMinDiff) then begin
     393  if (Abs(StartMousePoint.X - X) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) and
     394  (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin
    393395    if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) then begin
    394396      Core.Game.CurrentPlayer.View.SelectCell(Point(X, Y), Core.Game.CurrentPlayer, Shift);
  • trunk/Forms/UFormNew.pas

    r82 r90  
    311311    NewPlayer.Color := PlayerColors[Players.Count];
    312312    NewPlayer.Mode := pmComputer;
     313    NewPlayer.Agressivity := caMedium;
    313314    Players.Add(NewPlayer);
    314315    ReloadView;
  • trunk/Forms/UFormPlayer.lfm

    r29 r90  
    11object FormPlayer: TFormPlayer
    22  Left = 470
    3   Height = 303
     3  Height = 347
    44  Top = 219
    55  Width = 551
    66  Caption = 'Player'
    7   ClientHeight = 303
     7  ClientHeight = 347
    88  ClientWidth = 551
    99  LCLVersion = '1.3'
     
    2626    Left = 307
    2727    Height = 25
    28     Top = 252
     28    Top = 296
    2929    Width = 75
    3030    Anchors = [akRight, akBottom]
     
    3636    Left = 428
    3737    Height = 25
    38     Top = 252
     38    Top = 296
    3939    Width = 75
    4040    Anchors = [akRight, akBottom]
     
    8383    TabOrder = 4
    8484  end
     85  object Label4: TLabel
     86    Left = 24
     87    Height = 22
     88    Top = 168
     89    Width = 92
     90    Caption = 'Agressivity:'
     91    ParentColor = False
     92  end
     93  object ComboBoxAgressivity: TComboBox
     94    Left = 139
     95    Height = 30
     96    Top = 168
     97    Width = 368
     98    ItemHeight = 0
     99    Items.Strings = (
     100      'Low'
     101      'Medium'
     102      'High'
     103      ''
     104    )
     105    Style = csDropDownList
     106    TabOrder = 5
     107  end
     108  object CheckBoxDefensive: TCheckBox
     109    Left = 24
     110    Height = 24
     111    Top = 208
     112    Width = 103
     113    Caption = 'Defensive'
     114    TabOrder = 6
     115  end
    85116end
  • trunk/Forms/UFormPlayer.lrt

    r29 r90  
    66TFORMPLAYER.LABEL2.CAPTION=Mode:
    77TFORMPLAYER.LABEL3.CAPTION=Color:
     8TFORMPLAYER.LABEL4.CAPTION=Agressivity:
     9TFORMPLAYER.CHECKBOXDEFENSIVE.CAPTION=Defensive
  • trunk/Forms/UFormPlayer.pas

    r55 r90  
    1616    ButtonCancel: TButton;
    1717    ButtonOk: TButton;
     18    CheckBoxDefensive: TCheckBox;
    1819    ColorBox1: TColorBox;
    1920    ComboBox1: TComboBox;
     21    ComboBoxAgressivity: TComboBox;
    2022    EditName: TEdit;
    2123    Label1: TLabel;
    2224    Label2: TLabel;
    2325    Label3: TLabel;
     26    Label4: TLabel;
    2427  private
    2528    { private declarations }
     
    4043  SHuman = 'Human';
    4144  SComputer = 'Computer';
     45  SAgroNotAttacking = 'Not attacking';
     46  SAgroLow = 'Low';
     47  SAgroMedium = 'Medium';
     48  SAgroHigh = 'High';
    4249
    4350{ TFormPlayer }
     
    5461    ItemIndex := LastIndex;
    5562  end;
     63  with ComboBoxAgressivity do begin
     64    LastIndex := ItemIndex;
     65    Clear;
     66    Items.Add(SAgroLow);
     67    Items.Add(SAgroMedium);
     68    Items.Add(SAgroHigh);
     69    ItemIndex := LastIndex;
     70  end;
    5671end;
    5772
     
    6176  ComboBox1.ItemIndex := Integer(Player.Mode);
    6277  ColorBox1.Selected := Player.Color;
     78  Label4.Visible := Player.Mode = pmComputer;
     79  ComboBoxAgressivity.Visible := Player.Mode = pmComputer;
     80  ComboBoxAgressivity.ItemIndex := Integer(Player.Agressivity);
     81  CheckBoxDefensive.Visible := Player.Mode = pmComputer;
     82  CheckBoxDefensive.Checked := Player.Defensive;
    6383end;
    6484
     
    6888  Player.Mode := TPlayerMode(ComboBox1.ItemIndex);
    6989  Player.Color := ColorBox1.Selected;
     90  Player.Agressivity := TComputerAgressivity(ComboBoxAgressivity.ItemIndex);
     91  Player.Defensive := CheckBoxDefensive.Checked;
    7092end;
    7193
Note: See TracChangeset for help on using the changeset viewer.