Hex Values in the editor's info feature

Clang format before squash
This commit is contained in:
VoxelDoesCode 2022-10-11 18:23:11 -04:00
parent b7da20826d
commit 484cb82872
3 changed files with 14 additions and 2 deletions

View file

@ -910,7 +910,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
static int s_TileInfoButton = 0;
if(DoButton_Editor(&s_TileInfoButton, "Info", m_ShowTileInfo, &Button, 0, "[ctrl+i] Show tile information") ||
(Input()->KeyPress(KEY_I) && ModPressed))
(Input()->KeyPress(KEY_I) && ModPressed && !ShiftPressed))
{
m_ShowTileInfo = !m_ShowTileInfo;
m_ShowEnvelopePreview = SHOWENV_NONE;
@ -1250,6 +1250,16 @@ void CEditor::DoToolbar(CUIRect ToolBar)
m_BrushDrawDestructive = !m_BrushDrawDestructive;
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
}
// Hex values button
if(m_ShowTileInfo)
{
TB_Bottom.VSplitLeft(65.0f, &Button, &TB_Bottom);
static int s_TileInfoHexButton = 0;
if(DoButton_Editor(&s_TileInfoHexButton, "Hex Values", m_ShowTileHexInfo, &Button, 0, "[ctrl+shift+i] Show a tile's hex value") ||
(Input()->KeyPress(KEY_I) && ModPressed && ShiftPressed))
m_ShowTileHexInfo = !m_ShowTileHexInfo;
}
}
}

View file

@ -835,6 +835,7 @@ public:
m_PreventUnusedTilesWasWarned = false;
m_AllowPlaceUnusedTiles = 0;
m_BrushDrawDestructive = true;
m_ShowTileHexInfo = false;
m_GotoX = 0;
m_GotoY = 0;
@ -914,6 +915,7 @@ public:
bool m_PreventUnusedTilesWasWarned;
int m_AllowPlaceUnusedTiles;
bool m_BrushDrawDestructive;
bool m_ShowTileHexInfo;
int m_Mentions;

View file

@ -663,7 +663,7 @@ void CLayerTiles::ShowInfo()
if(m_pTiles[c].m_Index)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%i", m_pTiles[c].m_Index);
str_format(aBuf, sizeof(aBuf), m_pEditor->m_ShowTileHexInfo ? "%02X" : "%i", m_pTiles[c].m_Index);
m_pEditor->Graphics()->QuadsText(x * 32, y * 32, 16.0f, aBuf);
char aFlags[4] = {m_pTiles[c].m_Flags & TILEFLAG_VFLIP ? 'V' : ' ',