summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a00a3d6)
raw | patch | inline | side by side (parent: a00a3d6)
author | binarymaster <x86corez@gmail.com> | |
Sat, 30 Sep 2017 11:56:51 +0000 (14:56 +0300) | ||
committer | binarymaster <x86corez@gmail.com> | |
Sat, 30 Sep 2017 11:56:51 +0000 (14:56 +0300) |
index 2c4fa54acee18f590ae07976ab1a392eeeea60da..bc6af2d4c23c73f2a0d0011db4dda49ecf04d81f 100644 (file)
ClientWidth = 258
TabOrder = 6
object iPreview: TImage
- Left = 0
+ Left = 1
Height = 256
- Top = 0
+ Top = 1
Width = 256
end
end
index 0ab28a5586e623ebc0580fdfca4cff372e36e060..86566cfa9627df9eeab1238aed7ad118dd19bc41 100644 (file)
var
img: TImageData;
clr: TColor32Rec;
- bgc: Byte;
+ bgc: TColor32Rec;
ii: PByte;
Width,
Height: Integer;
// HACK: Lazarus's TBitMap doesn't seem to have a working 32 bit mode, so
// mix color with checkered background. Also, can't really read
// CHECKERS.tga from here. FUCK!
- if (((x shr 3) and 1) = 0) xor (((y shr 3) and 1) = 0) then
- bgc := 255
+ if UseCheckerboard then
+ begin
+ if (((x shr 3) and 1) = 0) xor (((y shr 3) and 1) = 0) then
+ bgc.Color := $FDFDFD
+ else
+ bgc.Color := $CBCBCB;
+ end
else
- bgc := 200;
- clr.r := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.r) div 255);
- clr.g := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.g) div 255);
- clr.b := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.b) div 255);
+ begin
+ bgc.r := GetRValue(PreviewColor);
+ bgc.g := GetGValue(PreviewColor);
+ bgc.b := GetBValue(PreviewColor);
+ end;
+ clr.r := ClampToByte((Byte(255 - clr.a) * bgc.r + clr.a * clr.r) div 255);
+ clr.g := ClampToByte((Byte(255 - clr.a) * bgc.g + clr.a * clr.g) div 255);
+ clr.b := ClampToByte((Byte(255 - clr.a) * bgc.b + clr.a * clr.b) div 255);
// TODO: check for RGB/BGR somehow?
ii^ := clr.b; Inc(ii);
ii^ := clr.g; Inc(ii);
diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index c5821c4fb5608f62e0321fdbe65fa418501d2e69..070939d11262449427ddd618720d851addd242b1 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
DrawPanelSize: Boolean;
BackColor: TColor;
PreviewColor: TColor;
+ UseCheckerboard: Boolean;
Scale: Byte;
RecentCount: Integer;
RecentFiles: TStringList;
DrawPanelSize := config.ReadBool('Editor', 'DrawPanelSize', True);
BackColor := config.ReadInt('Editor', 'BackColor', $7F6040);
PreviewColor := config.ReadInt('Editor', 'PreviewColor', $00FF00);
+ UseCheckerboard := config.ReadBool('Editor', 'UseCheckerboard', True);
gColorEdge := config.ReadInt('Editor', 'EdgeColor', COLOR_EDGE);
gAlphaEdge := config.ReadInt('Editor', 'EdgeAlpha', ALPHA_EDGE);
if gAlphaEdge = 255 then
if not g_GetTexture(SelectedTexture(), ID) then
g_GetTexture('NOTEXTURE', ID);
g_GetTextureSizeByID(ID, Width, Height);
- if g_GetTexture('PREVIEW', PID) then
- e_DrawFill(PID, RenderPanel.Width-Width, RenderPanel.Height-Height, Width div 16 + 1, Height div 16 + 1, 0, True, False);
+ if UseCheckerboard then
+ begin
+ if g_GetTexture('PREVIEW', PID) then
+ e_DrawFill(PID, RenderPanel.Width-Width, RenderPanel.Height-Height, Width div 16 + 1, Height div 16 + 1, 0, True, False);
+ end else
+ e_DrawFillQuad(RenderPanel.Width-Width-2, RenderPanel.Height-Height-2,
+ RenderPanel.Width-1, RenderPanel.Height-1,
+ GetRValue(PreviewColor), GetGValue(PreviewColor), GetBValue(PreviewColor), 0);
e_Draw(ID, RenderPanel.Width-Width, RenderPanel.Height-Height, 0, True, False);
end;
index 97ef8e2fd75a622bd0d06faedee9f0af34cb576a..b100ee3e6d2ac823a27912076782c6034189feea 100644 (file)
--- a/src/editor/f_options.lfm
+++ b/src/editor/f_options.lfm
object LabelMinimap: TLabel
Left = 190
Height = 13
- Top = 131
+ Top = 129
Width = 112
Caption = 'Масштаб мини-карты:'
ParentColor = False
Width = 11
Caption = '..'
OnClick = bPreviewClick
- TabOrder = 12
+ TabOrder = 13
end
object cbScale: TComboBox
Left = 344
Height = 21
- Top = 131
+ Top = 129
Width = 70
ItemHeight = 13
ItemIndex = 0
'2x'
)
Style = csDropDownList
- TabOrder = 13
+ TabOrder = 14
Text = '1x'
end
object cbShowTexture: TCheckBox
object eRecent: TEdit
Left = 344
Height = 21
- Top = 184
+ Top = 180
Width = 57
- TabOrder = 14
+ TabOrder = 15
Text = '5'
end
object UpDown3: TUpDown
Left = 401
Height = 21
- Top = 184
+ Top = 180
Width = 12
Associate = eRecent
Max = 10
Min = 2
Position = 5
- TabOrder = 15
+ TabOrder = 16
Wrap = False
end
object eDotStepTwo: TEdit
TabOrder = 7
Text = '1'
end
+ object cbCheckerboard: TCheckBox
+ Left = 190
+ Height = 17
+ Top = 94
+ Width = 145
+ Caption = 'Использовать шахматку'
+ Checked = True
+ State = cbChecked
+ TabOrder = 12
+ end
end
object bOK: TButton
Left = 262
index 926479ebc984fce733836e7dcf4efe914178050b..1f297ec217b0a6f7ba490f50f63a858f876d053b 100644 (file)
--- a/src/editor/f_options.pas
+++ b/src/editor/f_options.pas
TOptionsForm = class (TForm)
bOK: TButton;
bCancel: TButton;
+ cbCheckerboard: TCheckBox;
ColorDialog: TColorDialog;
GroupBox1: TGroupBox;
// Общие настройки:
eDotStepTwo.Text := IntToStr(DotStepTwo);
sBackColor.Brush.Color := BackColor;
sPreviewColor.Brush.Color := PreviewColor;
+ cbCheckerboard.Checked := UseCheckerboard;
if Scale = 2 then
cbScale.ItemIndex := 1
else
DrawPanelSize := cbShowSize.Checked;
BackColor := sBackColor.Brush.Color;
PreviewColor := sPreviewColor.Brush.Color;
+ UseCheckerboard := cbCheckerboard.Checked;
if cbScale.ItemIndex = 1 then
Scale := 2
config.WriteBool('Editor', 'DrawPanelSize', DrawPanelSize);
config.WriteInt('Editor', 'BackColor', BackColor);
config.WriteInt('Editor', 'PreviewColor', PreviewColor);
+ config.WriteBool('Editor', 'UseCheckerboard', UseCheckerboard);
config.WriteInt('Editor', 'Scale', cbScale.ItemIndex);
config.WriteInt('Editor', 'RecentCount', re);
config.WriteStr('Editor', 'Language', gLanguage);
index 7bb6fb3764c723810731e03d3c6f1ba9ea0c6b1e..af9b436f867e3f518dc1b11cb250120fe8374bf8 100644 (file)
I_CTRL_ES_GRID,
I_CTRL_ES_TEXTURE,
I_CTRL_ES_PANEL_SIZE,
+ I_CTRL_ES_CHECKERBOARD,
I_CTRL_PACK_TEXTURES,
I_CTRL_PACK_SKY,
'Показывать текстуру панели'),
('CTRL ES PANEL SIZE', 'Show Panel Size',
'Показывать размеры панели '),
+ ('CTRL ES CHECKERBOARD', 'Use Checkerboard',
+ 'Использовать шахматку'),
('CTRL PACK TEXTURES', 'Textures',
'Текстуры'),
cbShowDots.Caption := _lc[I_CTRL_ES_GRID];
cbShowTexture.Caption := _lc[I_CTRL_ES_TEXTURE];
cbShowSize.Caption := _lc[I_CTRL_ES_PANEL_SIZE];
+ cbCheckerboard.Caption := _lc[I_CTRL_ES_CHECKERBOARD];
LabelGrid.Caption := _lc[I_LAB_ES_GRID];
LabelGridCol.Caption := _lc[I_LAB_ES_GRID_COLOR];
LabelBack.Caption := _lc[I_LAB_ES_BACK];