Remove ifs when drawing quads QoL buttons

This commit is contained in:
Corantin H 2023-12-26 18:35:36 +01:00
parent b77e91633f
commit 70d263a7d5

View file

@ -339,18 +339,16 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect
Selector.VSplitMid(&No, &Yes); Selector.VSplitMid(&No, &Yes);
pEditor->UI()->DoLabel(&Label, "Align quads", 10.0f, TEXTALIGN_ML); pEditor->UI()->DoLabel(&Label, "Align quads", 10.0f, TEXTALIGN_ML);
if(pEditor->m_AllowPlaceUnusedTiles != -1)
static int s_ButtonNo = 0;
static int s_ButtonYes = 0;
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !g_Config.m_EdAlignQuads, &No, 0, "Do not perform quad alignment to other quads/points when moving quads"))
{ {
static int s_ButtonNo = 0; g_Config.m_EdAlignQuads = false;
static int s_ButtonYes = 0; }
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !g_Config.m_EdAlignQuads, &No, 0, "Do not perform quad alignment to other quads/points when moving quads")) if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", g_Config.m_EdAlignQuads, &Yes, 0, "Allow quad alignment to other quads/points when moving quads"))
{ {
g_Config.m_EdAlignQuads = false; g_Config.m_EdAlignQuads = true;
}
if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", g_Config.m_EdAlignQuads, &Yes, 0, "Allow quad alignment to other quads/points when moving quads"))
{
g_Config.m_EdAlignQuads = true;
}
} }
} }
@ -365,18 +363,16 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect
Selector.VSplitMid(&No, &Yes); Selector.VSplitMid(&No, &Yes);
pEditor->UI()->DoLabel(&Label, "Show quads bounds", 10.0f, TEXTALIGN_ML); pEditor->UI()->DoLabel(&Label, "Show quads bounds", 10.0f, TEXTALIGN_ML);
if(pEditor->m_AllowPlaceUnusedTiles != -1)
static int s_ButtonNo = 0;
static int s_ButtonYes = 0;
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !g_Config.m_EdShowQuadsRect, &No, 0, "Do not show quad bounds when moving quads"))
{ {
static int s_ButtonNo = 0; g_Config.m_EdShowQuadsRect = false;
static int s_ButtonYes = 0; }
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !g_Config.m_EdShowQuadsRect, &No, 0, "Do not show quad bounds when moving quads")) if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", g_Config.m_EdShowQuadsRect, &Yes, 0, "Show quad bounds when moving quads"))
{ {
g_Config.m_EdShowQuadsRect = false; g_Config.m_EdShowQuadsRect = true;
}
if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", g_Config.m_EdShowQuadsRect, &Yes, 0, "Show quad bounds when moving quads"))
{
g_Config.m_EdShowQuadsRect = true;
}
} }
} }