Changeset 317


Ignore:
Timestamp:
Mar 19, 2021, 9:59:02 AM (10 months ago)
Author:
chronos
Message:
  • Added: Allow to set gamma corection in settings dialog.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Integrated.lpi

    r292 r317  
    380380    <Other>
    381381      <CompilerMessages>
    382         <IgnoredMessages idx5024="True"/>
     382        <IgnoredMessages idx6058="True" idx5024="True"/>
    383383      </CompilerMessages>
    384384      <CustomOptions Value="-dDEBUG"/>
  • trunk/Language.txt

    r167 r317  
    945945#SETTINGS
    946946Full screen
     947Gamma
     948Restart is needed to apply changes
  • trunk/Localization/cs/Language.txt

    r167 r317  
    945945#SETTINGS
    946946Celá obrazovka
     947Gamma
     948Pro projevení změn je potřeba restart
  • trunk/Packages/CevoComponents/BaseWin.pas

    r290 r317  
    153153begin
    154154  if FWindowMode = wmSubmodal then
    155     Close
     155    Close;
    156156end;
    157157
     
    316316    else
    317317      MainTexture := MainTexture;
    318     MainTexture := MainTexture
     318    MainTexture := MainTexture;
    319319  end;
    320320  Canvas.Font.Assign(UniFont[ftCaption]);
     
    330330  begin
    331331    FrameTop := 0;
    332     FrameBottom := ClientHeight
     332    FrameBottom := ClientHeight;
    333333  end
    334334  else
     
    338338      FrameBottom := ClientHeight - (WideFrame - NarrowFrame)
    339339    else
    340       FrameBottom := ClientHeight
     340      FrameBottom := ClientHeight;
    341341  end;
    342342  Fill(Canvas, 3, InnerBottom + 1, ClientWidth - 6, ClientHeight - InnerBottom -
     
    386386        MoveTo(ClientWidth - 3 - ModalFrameIndent, 3);
    387387        LineTo(ClientWidth - 3 - ModalFrameIndent, TitleHeight);
    388       end
     388      end;
    389389  end
    390390  else
     
    441441        LineTo(ClientWidth - CaptionLeft - 2, FrameBottom - 2);
    442442      end;
    443     end
     443    end;
    444444  end;
    445445  RisedTextOut(Canvas, Cut - 1, 7, Caption);
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r316 r317  
    9292procedure VLightGradient(ca: TCanvas; x, y, Height, Color: integer);
    9393procedure VDarkGradient(ca: TCanvas; x, y, Height, Kind: integer);
     94procedure UnderlinedTitleValue(Canvas: TCanvas; Title, Value: string; X, Y, Width: Integer);
    9495procedure NumberBar(dst: TBitmap; x, y: integer; Cap: string; val: integer;
    9596  const T: TTexture);
     
    13131314  Gradient(ca, x, y, 1, 0, 0, Height,
    13141315    HGrSystem.Data.Canvas.Pixels[187, 137 + Kind], Brightness);
     1316end;
     1317
     1318procedure UnderlinedTitleValue(Canvas: TCanvas; Title, Value: string; X, Y, Width: Integer);
     1319begin
     1320  DLine(Canvas, X, X + Width, Y + 19, MainTexture.clBevelLight, MainTexture.clBevelShade);
     1321  RisedTextOut(Canvas, X, Y, Title);
     1322  RisedTextOut(Canvas, X + Width - BiColorTextWidth(Canvas, Value), Y, Value);
    13151323end;
    13161324
  • trunk/Packages/CevoComponents/Sound.pas

    r290 r317  
    1111type
    1212  TPlayStyle = (psAsync, psSync);
     13  TSoundMode = (smOff, smOn, smOnAlt);
    1314
    1415  { TSoundPlayer }
     
    5051procedure PreparePlay(Item: string; Index: Integer = -1);
    5152
    52 const
    53   // sound modes
    54   smOff = 0;
    55   smOn = 1;
    56   smOnAlt = 2;
    57 
    5853var
    5954  Sounds: TStringTable;
    60   SoundMode: Integer;
     55  SoundMode: TSoundMode;
    6156  SoundPlayer: TSoundPlayer;
    6257  SoundList: TFPGObjectList<TSound>;
  • trunk/Settings.lfm

    r259 r317  
    1414  OnPaint = FormPaint
    1515  OnShow = FormShow
    16   LCLVersion = '2.0.2.0'
    1716  Position = poScreenCenter
    18   PixelsPerInch = 96
     17  LCLVersion = '2.0.12.0'
    1918  Scaled = False
    2019  object List: TListBox
    2120    Tag = 15360
    2221    Left = 24
    23     Height = 336
     22    Height = 304
    2423    Top = 16
    2524    Width = 424
     
    6867    ButtonIndex = 0
    6968  end
     69  object Up2Btn: TButtonC
     70    Tag = 6912
     71    Left = 432
     72    Height = 12
     73    Top = 328
     74    Width = 12
     75    Down = False
     76    Permanent = False
     77    OnClick = Up2BtnClick
     78    ButtonIndex = 1
     79  end
     80  object Down2Btn: TButtonC
     81    Tag = 6912
     82    Left = 432
     83    Height = 12
     84    Top = 340
     85    Width = 12
     86    Down = False
     87    Permanent = False
     88    OnClick = Down2BtnClick
     89    ButtonIndex = 0
     90  end
    7091end
  • trunk/Settings.pas

    r309 r317  
    2828  TSettingsDlg = class(TDrawDlg)
    2929    ButtonFullscreen: TButtonC;
     30    Down2Btn: TButtonC;
    3031    List: TListBox;
    3132    OKBtn: TButtonA;
    3233    CancelBtn: TButtonA;
     34    Up2Btn: TButtonC;
    3335    procedure ButtonFullscreenClick(Sender: TObject);
    3436    procedure CancelBtnClick(Sender: TObject);
     37    procedure Down2BtnClick(Sender: TObject);
    3538    procedure FormCreate(Sender: TObject);
    3639    procedure FormDestroy(Sender: TObject);
     
    3841    procedure FormShow(Sender: TObject);
    3942    procedure OKBtnClick(Sender: TObject);
     43    procedure Up2BtnClick(Sender: TObject);
    4044  private
    41     { private declarations }
     45    LocalGamma: Integer;
    4246  public
    4347    Languages: TLanguages;
     
    111115end;
    112116
     117procedure TSettingsDlg.Down2BtnClick(Sender: TObject);
     118begin
     119  if LocalGamma > 50 then
     120  begin
     121    Dec(LocalGamma);
     122    Invalidate;
     123  end;
     124end;
     125
    113126procedure TSettingsDlg.ButtonFullscreenClick(Sender: TObject);
    114127begin
     
    139152    MainTexture.clBevelLight);
    140153
    141   s := Phrases.Lookup('SETTINGS', 0);
     154  S := Phrases.Lookup('SETTINGS', 0);
    142155  LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + 32,
    143     ButtonFullscreen.Top - 4, s);
     156    ButtonFullscreen.Top - 4, S);
     157
     158  // Gamma
     159  UnderlinedTitleValue(Canvas, Phrases.Lookup('SETTINGS', 1), IntToStr(LocalGamma) + '%',
     160    Up2Btn.Left - 150 - 4, Up2Btn.Top + 2, 150);
    144161end;
    145162
     
    155172  SaveData;
    156173  ModalResult := mrOk;
     174end;
     175
     176procedure TSettingsDlg.Up2BtnClick(Sender: TObject);
     177begin
     178  if LocalGamma < 150 then begin
     179    Inc(LocalGamma);
     180    Invalidate;
     181  end;
    157182end;
    158183
     
    164189  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    165190    else ButtonFullscreen.ButtonIndex := 2;
     191  LocalGamma := Gamma;
    166192end;
    167193
    168194procedure TSettingsDlg.SaveData;
    169 begin
     195var
     196  NeedRestart: Boolean;
     197begin
     198  NeedRestart := Gamma <> LocalGamma;
    170199  LocaleCode := Languages[List.ItemIndex].ShortName;
    171200  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
     201  Gamma := LocalGamma;
     202  if NeedRestart then SimpleMessage(Phrases.Lookup('SETTINGS', 2));
    172203end;
    173204
  • trunk/Start.pas

    r316 r317  
    894894  else if Page in [pgStartRandom, pgStartMap] then
    895895  begin
    896     DLine(Canvas, 344, 514, y0Mini + 61 + 19, MainTexture.clBevelLight,
    897       MainTexture.clBevelShade);
    898     RisedTextOut(Canvas, 344, y0Mini + 61, Phrases.Lookup('STARTCONTROLS', 10));
    899     s := TurnToString(MaxTurn);
    900     RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini + 61, s);
     896    UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 10),
     897      TurnToString(MaxTurn), 344, y0Mini + 61, 170);
     898
    901899    s := Phrases.Lookup('STARTCONTROLS', 7);
    902900    w := Canvas.TextWidth(s);
     
    974972        s := IntToStr(nMapStartPositions - 1);
    975973      RisedTextOut(Canvas, 198 - BiColorTextWidth(Canvas, s), yMain + 140, s);
     974
    976975      DLine(Canvas, 24, xDefault - 6, yMain + 164 + 19,
    977976        MainTexture.clBevelLight, MainTexture.clBevelShade);
     
    986985      DLine(Canvas, 56, 272, y0Mini + 61 + 19, MainTexture.clBevelLight,
    987986        MainTexture.clBevelShade);
     987
    988988      RisedTextOut(Canvas, 56, y0Mini + 61,
    989989        Phrases.Lookup('STARTCONTROLS', 14));
     
    10241024  else if Page = pgEditRandom then
    10251025  begin
    1026     DLine(Canvas, 344, 514, y0Mini - 77 + 19, MainTexture.clBevelLight,
    1027       MainTexture.clBevelShade);
    1028     RisedTextOut(Canvas, 344, y0Mini - 77, Phrases.Lookup('STARTCONTROLS', 5));
    1029     s := IntToStr((WorldSizes[WorldSize].X * WorldSizes[WorldSize].Y * 20 +
    1030       DefaultWorldTiles div 2) div DefaultWorldTiles * 5) + '%';
    1031     RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini - 77, s);
    1032     DLine(Canvas, 344, 514, y0Mini + 61 + 19, MainTexture.clBevelLight,
    1033       MainTexture.clBevelShade);
    1034     RisedTextOut(Canvas, 344, y0Mini + 61, Phrases.Lookup('STARTCONTROLS', 6));
    1035     s := IntToStr(StartLandMass) + '%';
    1036     RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini + 61, s);
     1026    UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 5),
     1027      IntToStr((WorldSizes[WorldSize].X * WorldSizes[WorldSize].Y * 20 +
     1028      DefaultWorldTiles div 2) div DefaultWorldTiles * 5) + '%',
     1029      344, y0Mini - 77, 170);
     1030    UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 6),
     1031      IntToStr(StartLandMass) + '%', 344, y0Mini + 61, 170);
    10371032  end
    10381033  else if Page = pgEditMap then
Note: See TracChangeset for help on using the changeset viewer.