1289: Add a toggle button for brush coloring r=def- a=bojidar-bg

In some cases (very dark color, etc.) it is impossible to see the tiles.
Closes #1285.

Co-authored-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
This commit is contained in:
bors[bot] 2018-09-11 11:22:50 +00:00
commit 46a34f044a
3 changed files with 52 additions and 14 deletions

View file

@ -1129,6 +1129,15 @@ void CEditor::DoToolbar(CUIRect ToolBar)
m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles;
}
TB_Top.VSplitLeft(5.0f, 0, &TB_Top);
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
static int s_ColorBrushButton = 0;
if(DoButton_Editor(&s_ColorBrushButton, "Color", m_BrushColorEnabled, &Button, 0, "Toggle brush coloring"))
{
m_BrushColorEnabled = !m_BrushColorEnabled;
}
TB_Top.VSplitLeft(10.0f, 0, &TB_Top);
// zoom group
@ -2353,8 +2362,15 @@ void CEditor::DoMapEditor(CUIRect View)
Graphics()->MapScreen(x, y, x+w, y+h);
m_TilesetPicker.m_Image = t->m_Image;
m_TilesetPicker.m_TexID = t->m_TexID;
m_TilesetPicker.m_Color = t->m_Color;
m_TilesetPicker.m_Color.a = 255;
if (m_BrushColorEnabled)
{
m_TilesetPicker.m_Color = t->m_Color;
m_TilesetPicker.m_Color.a = 255;
}
else
{
m_TilesetPicker.m_Color = {255, 255, 255, 255};
}
m_TilesetPicker.m_Tele = t->m_Tele;
m_TilesetPicker.m_Speedup = t->m_Speedup;

View file

@ -642,6 +642,8 @@ public:
m_GridActive = false;
m_GridFactor = 1;
m_BrushColorEnabled = true;
m_aFileName[0] = 0;
m_aFileSaveName[0] = 0;
m_ValidSaveFilename = false;
@ -784,6 +786,8 @@ public:
bool m_GridActive;
int m_GridFactor;
bool m_BrushColorEnabled;
char m_aFileName[512];
char m_aFileSaveName[512];
bool m_ValidSaveFilename;

View file

@ -182,8 +182,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);
@ -211,8 +214,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);
@ -246,8 +252,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);
@ -280,8 +289,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);
@ -311,8 +323,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);
@ -329,8 +344,11 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
pGrabbed->m_TexID = m_TexID;
pGrabbed->m_Image = m_Image;
pGrabbed->m_Game = m_Game;
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
if (m_pEditor->m_BrushColorEnabled)
{
pGrabbed->m_Color = m_Color;
pGrabbed->m_Color.a = 255;
}
pBrush->AddLayer(pGrabbed);