Changeset 89


Ignore:
Timestamp:
Jun 7, 2024, 4:35:46 PM (7 months ago)
Author:
chronos
Message:
  • Added: Allow to select color palette in new game dialog.
  • Fixed: Use scrollboxes in options dialogs.
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormNew.lfm

    r86 r89  
    11object FormNew: TFormNew
    2   Left = 703
    3   Height = 266
    4   Top = 694
    5   Width = 501
     2  Left = 1029
     3  Height = 322
     4  Top = 587
     5  Width = 514
    66  Caption = 'New game'
    7   ClientHeight = 266
    8   ClientWidth = 501
     7  ClientHeight = 322
     8  ClientWidth = 514
    99  DesignTimePPI = 144
    1010  OnCreate = FormCreate
    1111  LCLVersion = '3.4.0.0'
    12   object Label1: TLabel
    13     Left = 16
    14     Height = 26
    15     Top = 16
    16     Width = 93
    17     Caption = 'Board size:'
    18     ParentColor = False
    19   end
    20   object ComboBoxSize: TComboBox
    21     Left = 173
     12  object ButtonCancel: TButton
     13    Left = 255
    2214    Height = 38
    23     Top = 11
    24     Width = 262
    25     ItemHeight = 0
    26     Items.Strings = (
    27       '2 x 2'
    28       '3 x 3'
    29       '4 x 4'
    30       '5 x 5'
    31       '6 x 6'
    32       '7 x 7'
    33       '8 x 8'
    34       '9 x 9'
    35       '10 x 10 '
    36       '11 x 11'
    37       '12 x 12'
    38     )
    39     Style = csDropDownList
     15    Top = 271
     16    Width = 116
     17    Anchors = [akRight, akBottom]
     18    Caption = 'Cancel'
     19    ModalResult = 2
    4020    TabOrder = 0
    4121  end
    42   object ButtonCancel: TButton
    43     Left = 120
     22  object ButtonOk: TButton
     23    Left = 391
    4424    Height = 38
    45     Top = 212
    46     Width = 113
    47     Anchors = [akLeft, akBottom]
    48     Caption = 'Cancel'
    49     ModalResult = 2
     25    Top = 271
     26    Width = 116
     27    Anchors = [akRight, akBottom]
     28    Caption = 'OK'
     29    ModalResult = 1
    5030    TabOrder = 1
    5131  end
    52   object ButtonOk: TButton
    53     Left = 280
    54     Height = 38
    55     Top = 212
    56     Width = 113
    57     Anchors = [akLeft, akBottom]
    58     Caption = 'OK'
    59     ModalResult = 1
     32  object ScrollBox1: TScrollBox
     33    Left = 8
     34    Height = 247
     35    Top = 8
     36    Width = 497
     37    HorzScrollBar.Page = 435
     38    VertScrollBar.Page = 214
     39    Anchors = [akTop, akLeft, akRight, akBottom]
     40    ClientHeight = 245
     41    ClientWidth = 495
    6042    TabOrder = 2
    61   end
    62   object CheckBoxUndoEnabled: TCheckBox
    63     Left = 16
    64     Height = 30
    65     Top = 56
    66     Width = 145
    67     Caption = 'Undo enabled'
    68     TabOrder = 3
    69   end
    70   object CheckBoxRecordHistory: TCheckBox
    71     Left = 16
    72     Height = 30
    73     Top = 88
    74     Width = 209
    75     Caption = 'Record moves history'
    76     TabOrder = 4
    77   end
    78   object Label2: TLabel
    79     Left = 16
    80     Height = 26
    81     Top = 125
    82     Width = 75
    83     Caption = 'Tile skin:'
    84     ParentColor = False
    85   end
    86   object ComboBoxSkin: TComboBox
    87     Left = 173
    88     Height = 38
    89     Top = 120
    90     Width = 262
    91     ItemHeight = 0
    92     Items.Strings = (
    93       ''
    94     )
    95     Style = csDropDownList
    96     TabOrder = 5
     43    object Label1: TLabel
     44      Left = 16
     45      Height = 26
     46      Top = 16
     47      Width = 93
     48      Caption = 'Board size:'
     49      ParentColor = False
     50    end
     51    object ComboBoxSize: TComboBox
     52      Left = 173
     53      Height = 38
     54      Top = 11
     55      Width = 262
     56      ItemHeight = 0
     57      Items.Strings = (
     58        '2 x 2'
     59        '3 x 3'
     60        '4 x 4'
     61        '5 x 5'
     62        '6 x 6'
     63        '7 x 7'
     64        '8 x 8'
     65        '9 x 9'
     66        '10 x 10 '
     67        '11 x 11'
     68        '12 x 12'
     69      )
     70      Style = csDropDownList
     71      TabOrder = 0
     72    end
     73    object CheckBoxUndoEnabled: TCheckBox
     74      Left = 16
     75      Height = 30
     76      Top = 56
     77      Width = 145
     78      Caption = 'Undo enabled'
     79      TabOrder = 1
     80    end
     81    object CheckBoxRecordHistory: TCheckBox
     82      Left = 16
     83      Height = 30
     84      Top = 88
     85      Width = 209
     86      Caption = 'Record moves history'
     87      TabOrder = 2
     88    end
     89    object Label2: TLabel
     90      Left = 16
     91      Height = 26
     92      Top = 133
     93      Width = 75
     94      Caption = 'Tile skin:'
     95      ParentColor = False
     96    end
     97    object ComboBoxSkin: TComboBox
     98      Left = 173
     99      Height = 38
     100      Top = 128
     101      Width = 262
     102      ItemHeight = 0
     103      Items.Strings = (
     104        ''
     105      )
     106      Style = csDropDownList
     107      TabOrder = 3
     108    end
     109    object Label3: TLabel
     110      Left = 16
     111      Height = 26
     112      Top = 181
     113      Width = 113
     114      Caption = 'Color palette:'
     115      ParentColor = False
     116    end
     117    object ComboBoxColorPalette: TComboBox
     118      Left = 173
     119      Height = 38
     120      Top = 176
     121      Width = 262
     122      ItemHeight = 0
     123      Items.Strings = (
     124        'RGB'
     125        'RBG'
     126        'GRB'
     127        'GBR'
     128        'BGR'
     129        'BRG'
     130      )
     131      Style = csDropDownList
     132      TabOrder = 4
     133    end
    97134  end
    98135end
  • trunk/Forms/FormNew.lrj

    r86 r89  
    11{"version":1,"strings":[
    22{"hash":211211125,"name":"tformnew.caption","sourcebytes":[78,101,119,32,103,97,109,101],"value":"New game"},
    3 {"hash":103901194,"name":"tformnew.label1.caption","sourcebytes":[66,111,97,114,100,32,115,105,122,101,58],"value":"Board size:"},
    43{"hash":77089212,"name":"tformnew.buttoncancel.caption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"},
    54{"hash":1339,"name":"tformnew.buttonok.caption","sourcebytes":[79,75],"value":"OK"},
     5{"hash":103901194,"name":"tformnew.label1.caption","sourcebytes":[66,111,97,114,100,32,115,105,122,101,58],"value":"Board size:"},
    66{"hash":260260820,"name":"tformnew.checkboxundoenabled.caption","sourcebytes":[85,110,100,111,32,101,110,97,98,108,101,100],"value":"Undo enabled"},
    77{"hash":146862089,"name":"tformnew.checkboxrecordhistory.caption","sourcebytes":[82,101,99,111,114,100,32,109,111,118,101,115,32,104,105,115,116,111,114,121],"value":"Record moves history"},
    8 {"hash":125677626,"name":"tformnew.label2.caption","sourcebytes":[84,105,108,101,32,115,107,105,110,58],"value":"Tile skin:"}
     8{"hash":125677626,"name":"tformnew.label2.caption","sourcebytes":[84,105,108,101,32,115,107,105,110,58],"value":"Tile skin:"},
     9{"hash":35322186,"name":"tformnew.label3.caption","sourcebytes":[67,111,108,111,114,32,112,97,108,101,116,116,101,58],"value":"Color palette:"}
    910]}
  • trunk/Forms/FormNew.pas

    r86 r89  
    1616    CheckBoxRecordHistory: TCheckBox;
    1717    CheckBoxUndoEnabled: TCheckBox;
     18    ComboBoxColorPalette: TComboBox;
    1819    ComboBoxSize: TComboBox;
    1920    ComboBoxSkin: TComboBox;
    2021    Label1: TLabel;
    2122    Label2: TLabel;
     23    Label3: TLabel;
     24    ScrollBox1: TScrollBox;
    2225    procedure FormCreate(Sender: TObject);
    2326  public
     
    3134{$R *.lfm}
    3235
    33 uses
    34   Core;
    35 
    3636{ TFormNew }
    3737
    3838procedure TFormNew.FormCreate(Sender: TObject);
    3939var
    40   I: TTileSkin;
     40  TileSkin: TTileSkin;
     41  ColorPalette: TColorPalette;
    4142begin
    4243  ComboBoxSkin.Items.BeginUpdate;
    4344  try
    4445    ComboBoxSkin.Items.Clear;
    45     for I := Low(SkinText) to High(SkinText) do
    46       ComboBoxSkin.Items.Add(SkinText[I]);
     46    for TileSkin := Low(SkinText) to High(SkinText) do
     47      ComboBoxSkin.Items.Add(SkinText[TileSkin]);
    4748  finally
    4849    ComboBoxSkin.Items.EndUpdate;
     50  end;
     51
     52  ComboBoxColorPalette.Items.BeginUpdate;
     53  try
     54    ComboBoxColorPalette.Items.Clear;
     55    for ColorPalette := Low(ColorPaletteText) to High(ColorPaletteText) do
     56      ComboBoxColorPalette.Items.Add(ColorPaletteText[ColorPalette]);
     57  finally
     58    ComboBoxColorPalette.Items.EndUpdate;
    4959  end;
    5060end;
     
    5666  CheckBoxRecordHistory.Checked := Game.RecordHistory;
    5767  ComboBoxSkin.ItemIndex := Integer(Game.Skin);
     68  ComboBoxColorPalette.ItemIndex := Integer(Game.ColorPalette);
    5869end;
    5970
     
    6475  Game.RecordHistory := CheckBoxRecordHistory.Checked;
    6576  Game.Skin := TTileSkin(ComboBoxSkin.ItemIndex);
     77  Game.ColorPalette := TColorPalette(ComboBoxColorPalette.ItemIndex);
    6678end;
    6779
  • trunk/Forms/FormSettings.lfm

    r86 r89  
    11object FormSettings: TFormSettings
    2   Left = 979
    3   Height = 360
    4   Top = 385
    5   Width = 480
     2  Left = 838
     3  Height = 331
     4  Top = 468
     5  Width = 612
    66  Caption = 'Settings'
    7   ClientHeight = 360
    8   ClientWidth = 480
     7  ClientHeight = 331
     8  ClientWidth = 612
    99  DesignTimePPI = 144
    1010  OnCreate = FormCreate
    1111  OnShow = FormShow
    1212  LCLVersion = '3.4.0.0'
    13   object Label1: TLabel
    14     Left = 19
    15     Height = 26
    16     Top = 24
    17     Width = 170
    18     Caption = 'Animation duration:'
    19     ParentColor = False
    20   end
    21   object TrackBar1: TTrackBar
    22     Left = 208
    23     Height = 58
    24     Top = 16
    25     Width = 240
    26     Max = 1000
    27     Position = 0
    28     Anchors = [akTop, akLeft, akRight]
     13  object ButtonOk: TButton
     14    Left = 488
     15    Height = 38
     16    Top = 283
     17    Width = 113
     18    Anchors = [akRight, akBottom]
     19    Caption = 'OK'
    2920    TabOrder = 0
    30   end
    31   object ButtonOk: TButton
    32     Left = 112
    33     Height = 38
    34     Top = 291
    35     Width = 113
    36     Anchors = [akLeft, akBottom]
    37     Caption = 'OK'
    38     TabOrder = 1
    3921    OnClick = ButtonOkClick
    4022  end
    4123  object ButtonCancel: TButton
    42     Left = 256
     24    Left = 352
    4325    Height = 38
    44     Top = 288
     26    Top = 283
    4527    Width = 113
    46     Anchors = [akLeft, akBottom]
     28    Anchors = [akRight, akBottom]
    4729    Caption = 'Cancel'
    48     TabOrder = 2
     30    TabOrder = 1
    4931    OnClick = ButtonCancelClick
    5032  end
    51   object ComboBoxLanguage: TComboBox
    52     Left = 208
    53     Height = 42
    54     Top = 86
    55     Width = 230
    56     ItemHeight = 0
    57     Style = csDropDownList
    58     TabOrder = 3
    59   end
    60   object Label2: TLabel
    61     Left = 19
    62     Height = 26
    63     Top = 94
    64     Width = 88
    65     Caption = 'Language:'
    66     ParentColor = False
    67   end
    68   object ComboBoxTheme: TComboBox
    69     Left = 208
    70     Height = 42
    71     Top = 136
    72     Width = 230
    73     ItemHeight = 0
    74     Style = csDropDownList
    75     TabOrder = 4
    76   end
    77   object Label3: TLabel
    78     Left = 19
    79     Height = 26
    80     Top = 144
    81     Width = 63
    82     Caption = 'Theme:'
    83     ParentColor = False
     33  object ScrollBox1: TScrollBox
     34    Left = 8
     35    Height = 262
     36    Top = 8
     37    Width = 595
     38    HorzScrollBar.Page = 438
     39    VertScrollBar.Page = 178
     40    Anchors = [akTop, akLeft, akRight, akBottom]
     41    ClientHeight = 260
     42    ClientWidth = 593
     43    TabOrder = 2
     44    object Label1: TLabel
     45      Left = 19
     46      Height = 26
     47      Top = 24
     48      Width = 170
     49      Caption = 'Animation duration:'
     50      ParentColor = False
     51    end
     52    object TrackBar1: TTrackBar
     53      Left = 208
     54      Height = 58
     55      Top = 16
     56      Width = 372
     57      Max = 1000
     58      Position = 0
     59      Anchors = [akTop, akLeft, akRight]
     60      TabOrder = 0
     61    end
     62    object ComboBoxLanguage: TComboBox
     63      Left = 208
     64      Height = 42
     65      Top = 86
     66      Width = 230
     67      ItemHeight = 0
     68      Style = csDropDownList
     69      TabOrder = 1
     70    end
     71    object Label2: TLabel
     72      Left = 19
     73      Height = 26
     74      Top = 94
     75      Width = 88
     76      Caption = 'Language:'
     77      ParentColor = False
     78    end
     79    object ComboBoxTheme: TComboBox
     80      Left = 208
     81      Height = 42
     82      Top = 136
     83      Width = 230
     84      ItemHeight = 0
     85      Style = csDropDownList
     86      TabOrder = 2
     87    end
     88    object Label3: TLabel
     89      Left = 19
     90      Height = 26
     91      Top = 144
     92      Width = 63
     93      Caption = 'Theme:'
     94      ParentColor = False
     95    end
    8496  end
    8597end
  • trunk/Forms/FormSettings.lrj

    r86 r89  
    11{"version":1,"strings":[
    22{"hash":213582195,"name":"tformsettings.caption","sourcebytes":[83,101,116,116,105,110,103,115],"value":"Settings"},
    3 {"hash":10139450,"name":"tformsettings.label1.caption","sourcebytes":[65,110,105,109,97,116,105,111,110,32,100,117,114,97,116,105,111,110,58],"value":"Animation duration:"},
    43{"hash":1339,"name":"tformsettings.buttonok.caption","sourcebytes":[79,75],"value":"OK"},
    54{"hash":77089212,"name":"tformsettings.buttoncancel.caption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"},
     5{"hash":10139450,"name":"tformsettings.label1.caption","sourcebytes":[65,110,105,109,97,116,105,111,110,32,100,117,114,97,116,105,111,110,58],"value":"Animation duration:"},
    66{"hash":82521866,"name":"tformsettings.label2.caption","sourcebytes":[76,97,110,103,117,97,103,101,58],"value":"Language:"},
    77{"hash":95339402,"name":"tformsettings.label3.caption","sourcebytes":[84,104,101,109,101,58],"value":"Theme:"}
  • trunk/Forms/FormSettings.pas

    r86 r89  
    1919    Label2: TLabel;
    2020    Label3: TLabel;
     21    ScrollBox1: TScrollBox;
    2122    TrackBar1: TTrackBar;
    2223    procedure ButtonCancelClick(Sender: TObject);
  • trunk/Game.pas

    r86 r89  
    1111  TMoveDirection = (drNone, drLeft, drUp, drRight, drDown);
    1212  TTileAction = (taNone, taMove, taMerge, taAppear);
     13  TColorPalette = (cpOrangeYellow, cpGreenYellow, cpPinkBlue, cpBlueCyan,
     14    cpGreenCyan, cpPinkRed);
    1315
    1416  { TTile }
     
    109111    FCanUndo: Boolean;
    110112    FBoardUndo: TBoard;
     113    FColorPalette: TColorPalette;
    111114    FSkin: TTileSkin;
    112115    function GetTileColor(Value: Integer): TColor;
     
    117120    procedure RenderTile(Canvas: TCanvas; Tile: TTile; TileRect: TRect; WithText: Boolean);
    118121    procedure GameOver;
     122    procedure SetColorPalette(AValue: TColorPalette);
    119123    procedure SetSkin(AValue: TTileSkin);
    120124    procedure Win;
     
    162166    property RecordHistory: Boolean read FRecordHistory write SetRecordHistory;
    163167    property Skin: TTileSkin read FSkin write SetSkin;
     168    property ColorPalette: TColorPalette read FColorPalette write SetColorPalette;
    164169  end;
    165170
     
    169174var
    170175  SkinText: array[TTileSkin] of string;
     176  ColorPaletteText: array[TColorPalette] of string;
    171177
    172178const
     
    187193  STileShouldBeEmpty = 'Tile should be empty';
    188194
     195  // Color palette
     196  SOrangeYellow = 'Orange - yellow';
     197  SGreenYellow = 'Green - yellow';
     198  SPinkBlue = 'Pink - blue';
     199  SBlueCyan = 'Blue - cyan';
     200  SGreenCyan = 'Green - cyan';
     201  SPinkRed = 'Pink - red';
    189202
    190203procedure Translate;
     
    194207
    195208uses
    196   Core, MetaCanvas;
     209  Core, MetaCanvas, PixelPointer;
    197210
    198211procedure Translate;
     
    203216  SkinText[tsRoman] := SSkinRoman;
    204217  SkinText[tsBinary] := SSkinBinary;
     218
     219  ColorPaletteText[cpOrangeYellow] := SOrangeYellow;
     220  ColorPaletteText[cpGreenYellow] := SGreenYellow;
     221  ColorPaletteText[cpPinkBlue] := SPinkBlue;
     222  ColorPaletteText[cpBlueCyan] := SBlueCyan;
     223  ColorPaletteText[cpGreenCyan] := SGreenCyan;
     224  ColorPaletteText[cpPinkRed] := SPinkRed;
    205225end;
    206226
     
    267287  GameStep.Board.Clear;
    268288  GameStep.Skin := Game.Skin;
     289  GameStep.ColorPalette := Game.ColorPalette;
    269290  GameStep.Score := 0;
    270291  for I := 0 to Length(InitialTiles) - 1 do
     
    293314begin
    294315  FreeAndNil(Moves);
    295   inherited Destroy;
     316  inherited;
    296317end;
    297318
     
    442463begin
    443464  Size := Point(0, 0);
    444   inherited Destroy;
     465  inherited;
    445466end;
    446467
     
    519540  if Running and Assigned(FOnGameOver) then FOnGameOver(Self);
    520541  Running := False;
     542end;
     543
     544procedure TGame.SetColorPalette(AValue: TColorPalette);
     545begin
     546  if FColorPalette = AValue then Exit;
     547  FColorPalette := AValue;
     548  DoPaint;
    521549end;
    522550
     
    579607  FRunning := Source.FRunning;
    580608  Skin := Source.Skin;
     609  ColorPalette := Source.ColorPalette;
    581610end;
    582611
     
    11741203    WriteBool('RecordHistory', RecordHistory);
    11751204    WriteInteger('Skin', Integer(Skin));
     1205    WriteInteger('ColorPalette', Integer(ColorPalette));
    11761206    FBoardUndo.SaveToRegistry(Reg, TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\BoardUndo'));
    11771207    Board.SaveToRegistry(Reg, TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\Board'));
     
    11981228    RecordHistory := ReadBoolWithDefault('RecordHistory', False);
    11991229    Skin := TTileSkin(ReadIntegerWithDefault('Skin', Integer(tsPowerOfTwo)));
     1230    ColorPalette := TColorPalette(ReadIntegerWithDefault('ColorPalette', Integer(cpOrangeYellow)));
    12001231    FBoardUndo.LoadFromRegistry(Reg, TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\BoardUndo'));
    12011232    Board.LoadFromRegistry(Reg, TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\Board'));
     
    12291260
    12301261function TGame.GetTileColor(Value: Integer): TColor;
     1262var
     1263  Color: TPixel32;
    12311264begin
    12321265  if Core.Core.ThemeManager1.Theme.Name = 'Dark' then begin
     
    12631296    end;
    12641297  end;
     1298
     1299  Color.RGB := Result;
     1300  case ColorPalette of
     1301    cpOrangeYellow: Result := TColor(TPixel32.CreateRGB(Color.R, Color.G, Color.B));
     1302    cpGreenYellow: Result := TColor(TPixel32.CreateRGB(Color.R, Color.B, Color.G));
     1303    cpPinkBlue: Result := TColor(TPixel32.CreateRGB(Color.B, Color.R, Color.G));
     1304    cpBlueCyan: Result := TColor(TPixel32.CreateRGB(Color.B, Color.G, Color.R));
     1305    cpGreenCyan: Result := TColor(TPixel32.CreateRGB(Color.G, Color.B, Color.R));
     1306    cpPinkRed: Result := TColor(TPixel32.CreateRGB(Color.G, Color.R, Color.B));
     1307  end;
    12651308end;
    12661309
  • trunk/Languages/Game2048.cs.po

    r88 r89  
    6868msgstr "Změna jazyka"
    6969
     70#: game.sbluecyan
     71msgid "Blue - cyan"
     72msgstr "Modrá - tyrkysová"
     73
     74#: game.sgreencyan
     75msgid "Green - cyan"
     76msgstr "Zelená - tyrkysová"
     77
     78#: game.sgreenyellow
     79msgid "Green - yellow"
     80msgstr "Zelená - žlutá"
     81
     82#: game.sorangeyellow
     83msgid "Orange - yellow"
     84msgstr "Oranžová - žlutá"
     85
     86#: game.spinkblue
     87msgid "Pink - blue"
     88msgstr "Růžová - modrá"
     89
     90#: game.spinkred
     91msgid "Pink - red"
     92msgstr "Růžová - červená"
     93
    7094#: game.sscore
    7195msgctxt "game.sscore"
     
    238262msgstr "Povrch dlaždic:"
    239263
     264#: tformnew.label3.caption
     265msgid "Color palette:"
     266msgstr "Barevná paleta:"
     267
    240268#: tformsettings.buttoncancel.caption
    241269msgctxt "tformsettings.buttoncancel.caption"
  • trunk/Packages/Common/FindFile.pas

    r85 r89  
    7575constructor TFindFile.Create(AOwner: TComponent);
    7676begin
    77   inherited Create(AOwner);
     77  inherited;
    7878  Path := IncludeTrailingBackslash(UTF8Encode(GetCurrentDir));
    7979  FileMask := FilterAll;
  • trunk/Packages/Common/ListViewSort.pas

    r85 r89  
    136136constructor TListViewEx.Create(TheOwner: TComponent);
    137137begin
    138   inherited Create(TheOwner);
     138  inherited;
    139139  Filter := TListViewFilter.Create(Self);
    140140  Filter.Parent := Self;
     
    172172constructor TListViewFilter.Create(AOwner: TComponent);
    173173begin
    174   inherited Create(AOwner);
     174  inherited;
    175175  FStringGrid1 := TStringGrid.Create(Self);
    176176  FStringGrid1.Align := alClient;
  • trunk/Packages/Common/PixelPointer.pas

    r85 r89  
    1818    function GetRGB: Cardinal; inline;
    1919  public
     20    class function CreateRGB(R, G, B: Byte): TPixel32; static;
     21    class function CreateRGBA(R, G, B, A: Byte): TPixel32; static;
    2022    property RGB: Cardinal read GetRGB write SetRGB;
    2123    case Integer of
     
    104106end;
    105107
     108class function TPixel32.CreateRGB(R, G, B: Byte): TPixel32;
     109begin
     110  Result.R := R;
     111  Result.G := G;
     112  Result.B := B;
     113  Result.A := 0;
     114end;
     115
     116class function TPixel32.CreateRGBA(R, G, B, A: Byte): TPixel32;
     117begin
     118  Result.R := R;
     119  Result.G := G;
     120  Result.B := B;
     121  Result.A := A;
     122end;
     123
    106124procedure TPixel32.SetRGB(AValue: Cardinal);
    107125begin
  • trunk/Packages/Common/Pool.pas

    r85 r89  
    5757  try
    5858    Lock.Acquire;
    59     inherited SetTotalCount(AValue);
     59    inherited;
    6060  finally
    6161    Lock.Release;
     
    6767  try
    6868    Lock.Acquire;
    69     Result := inherited GetUsedCount;
     69    Result := inherited;
    7070  finally
    7171    Lock.Release;
     
    8888      end;
    8989    end;
    90     Result := inherited Acquire;
     90    Result := inherited;
    9191  finally
    9292    Lock.Release;
     
    9898  try
    9999    Lock.Acquire;
    100     inherited Release(Item);
     100    inherited;
    101101  finally
    102102    Lock.Release;
     
    113113begin
    114114  TotalCount := 0;
    115   Lock.Free;
     115  FreeAndNil(Lock);
    116116  inherited;
    117117end;
  • trunk/Packages/Common/RegistryEx.pas

    r85 r89  
    133133  //CloseKey;
    134134  {$ENDIF}
    135   Result := inherited OpenKey(Key, CanCreate);
     135  Result := inherited;
    136136end;
    137137
  • trunk/Packages/Common/StopWatch.pas

    r85 r89  
    1313  TStopWatch = class
    1414  private
    15     fFrequency : TLargeInteger;
    16     fIsRunning: Boolean;
    17     fIsHighResolution: Boolean;
    18     fStartCount, fStopCount : TLargeInteger;
    19     procedure SetTickStamp(var lInt : TLargeInteger) ;
     15    FFrequency: TLargeInteger;
     16    FIsRunning: Boolean;
     17    FIsHighResolution: Boolean;
     18    FStartCount, fStopCount: TLargeInteger;
     19    procedure SetTickStamp(var Value: TLargeInteger);
    2020    function GetElapsedTicks: TLargeInteger;
    2121    function GetElapsedMiliseconds: TLargeInteger;
    2222    function GetElapsed: string;
    2323  public
    24     constructor Create(const startOnCreate : Boolean = False) ;
     24    constructor Create(const StartOnCreate: Boolean = False) ;
    2525    procedure Start;
    2626    procedure Stop;
    27     property IsHighResolution : Boolean read fIsHighResolution;
    28     property ElapsedTicks : TLargeInteger read GetElapsedTicks;
    29     property ElapsedMiliseconds : TLargeInteger read GetElapsedMiliseconds;
    30     property Elapsed : string read GetElapsed;
    31     property IsRunning : Boolean read fIsRunning;
     27    property IsHighResolution: Boolean read FIsHighResolution;
     28    property ElapsedTicks: TLargeInteger read GetElapsedTicks;
     29    property ElapsedMiliseconds: TLargeInteger read GetElapsedMiliseconds;
     30    property Elapsed: string read GetElapsed;
     31    property IsRunning: Boolean read FIsRunning;
    3232  end;
    3333
     
    3535implementation
    3636
    37 constructor TStopWatch.Create(const startOnCreate : boolean = false) ;
     37constructor TStopWatch.Create(const StartOnCreate: Boolean = False);
    3838begin
    39   inherited Create;
    40 
    41   fIsRunning := False;
     39  FIsRunning := False;
    4240
    4341  {$IFDEF WINDOWS}
    4442  fIsHighResolution := QueryPerformanceFrequency(fFrequency) ;
    4543  {$ELSE}
    46   fIsHighResolution := False;
     44  FIsHighResolution := False;
    4745  {$ENDIF}
    48   if NOT fIsHighResolution then fFrequency := MSecsPerSec;
     46  if NOT FIsHighResolution then FFrequency := MSecsPerSec;
    4947
    5048  if StartOnCreate then Start;
     
    5351function TStopWatch.GetElapsedTicks: TLargeInteger;
    5452begin
    55   Result := fStopCount - fStartCount;
     53  Result := FStopCount - FStartCount;
    5654end;
    5755
    58 procedure TStopWatch.SetTickStamp(var lInt : TLargeInteger) ;
     56procedure TStopWatch.SetTickStamp(var Value: TLargeInteger);
    5957begin
    60   if fIsHighResolution then
     58  if FIsHighResolution then
    6159    {$IFDEF Windows}
    6260    QueryPerformanceCounter(lInt)
     
    6462    {$ENDIF}
    6563  else
    66     lInt := MilliSecondOf(Now) ;
     64    Value := MilliSecondOf(Now);
    6765end;
    6866
    6967function TStopWatch.GetElapsed: string;
    7068var
    71   dt: TDateTime;
     69  Elapsed: TDateTime;
    7270begin
    73   dt := ElapsedMiliseconds / MSecsPerSec / SecsPerDay;
    74   result := Format('%d days, %s', [Trunc(dt), FormatDateTime('hh:nn:ss.z', Frac(dt))]) ;
     71  Elapsed := ElapsedMiliseconds / MSecsPerSec / SecsPerDay;
     72  Result := Format('%d days, %s', [Trunc(Elapsed), FormatDateTime('hh:nn:ss.z', Frac(Elapsed))]) ;
    7573end;
    7674
    7775function TStopWatch.GetElapsedMiliseconds: TLargeInteger;
    7876begin
    79   Result := (MSecsPerSec * (fStopCount - fStartCount)) div fFrequency;
     77  Result := (MSecsPerSec * (fStopCount - FStartCount)) div FFrequency;
    8078end;
    8179
    8280procedure TStopWatch.Start;
    8381begin
    84   SetTickStamp(fStartCount);
    85   fIsRunning := True;
     82  SetTickStamp(FStartCount);
     83  FIsRunning := True;
    8684end;
    8785
    8886procedure TStopWatch.Stop;
    8987begin
    90   SetTickStamp(fStopCount);
    91   fIsRunning := False;
     88  SetTickStamp(FStopCount);
     89  FIsRunning := False;
    9290end;
    9391
  • trunk/Packages/Common/Threading.pas

    r85 r89  
    188188constructor TThreadList.Create;
    189189begin
    190   inherited Create;
     190  inherited;
    191191end;
    192192
Note: See TracChangeset for help on using the changeset viewer.