Add: Debug tool to draw widget outlines. (#11401)

This is considered a developer tool and is controlled from the help menu (or default hotkey Ctrl-O).

This draws a white dashed outline around widgets. NWidgetSpacer and (unused) WWT_EMPTY widgets are also filled with check pattern to highlight them, as they usually indicate a design issue.
This commit is contained in:
2023-10-28 19:07:50 +01:00
committed by GitHub
parent 129e98fbab
commit c0aa9a5f87
5 changed files with 91 additions and 29 deletions

View File

@@ -186,6 +186,7 @@ enum {
GHK_CONSOLE,
GHK_BOUNDING_BOXES,
GHK_DIRTY_BLOCKS,
GHK_WIDGET_OUTLINES,
GHK_CENTER,
GHK_CENTER_ZOOM,
GHK_RESET_OBJECT_TO_PLACE,
@@ -307,6 +308,10 @@ struct MainWindow : Window
case GHK_DIRTY_BLOCKS:
ToggleDirtyBlocks();
return ES_HANDLED;
case GHK_WIDGET_OUTLINES:
ToggleWidgetOutlines();
return ES_HANDLED;
}
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
@@ -467,6 +472,7 @@ struct MainWindow : Window
Hotkey(WKC_BACKQUOTE, "console", GHK_CONSOLE),
Hotkey('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
Hotkey('O' | WKC_CTRL, "widget_outlines", GHK_WIDGET_OUTLINES),
Hotkey('C', "center", GHK_CENTER),
Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),