mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Add quick action "Toggle Grid"
This commit is contained in:
parent
30acedaac5
commit
8b304cab23
|
@ -1102,10 +1102,10 @@ void CEditor::DoToolbarLayers(CUIRect ToolBar)
|
|||
// grid button
|
||||
TB_Top.VSplitLeft(25.0f, &Button, &TB_Top);
|
||||
static int s_GridButton = 0;
|
||||
if(DoButton_FontIcon(&s_GridButton, FONT_ICON_BORDER_ALL, MapView()->MapGrid()->IsEnabled(), &Button, 0, "[ctrl+g] Toggle Grid", IGraphics::CORNER_L) ||
|
||||
if(DoButton_FontIcon(&s_GridButton, FONT_ICON_BORDER_ALL, m_QuickActionToggleGrid.Active(), &Button, 0, m_QuickActionToggleGrid.Description(), IGraphics::CORNER_L) ||
|
||||
(m_Dialog == DIALOG_NONE && CLineInput::GetActiveInput() == nullptr && Input()->KeyPress(KEY_G) && ModPressed && !ShiftPressed))
|
||||
{
|
||||
MapView()->MapGrid()->Toggle();
|
||||
m_QuickActionToggleGrid.Call();
|
||||
}
|
||||
|
||||
// grid settings button
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
#define ALWAYS_FALSE []() -> bool { return false; }
|
||||
#define DEFAULT_BTN []() -> int { return -1; }
|
||||
|
||||
REGISTER_QUICK_ACTION(
|
||||
ToggleGrid,
|
||||
"Toggle Grid",
|
||||
[&]() { MapView()->MapGrid()->Toggle(); },
|
||||
ALWAYS_FALSE,
|
||||
[&]() -> bool { return MapView()->MapGrid()->IsEnabled(); },
|
||||
DEFAULT_BTN,
|
||||
"[ctrl+g] Toggle Grid")
|
||||
REGISTER_QUICK_ACTION(
|
||||
GameTilesAir,
|
||||
"Game tiles: Air",
|
||||
|
|
Loading…
Reference in a new issue