Skip to content

Commit

Permalink
GUIFormSpecMenu: Add basic element highlighing debug feature (#9423)
Browse files Browse the repository at this point in the history
Activated using F5
SmallJoker authored Apr 12, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d7e706a commit 6cf15cf
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/guiFormSpecMenu.cpp
Original file line number Diff line number Diff line change
@@ -3380,8 +3380,12 @@ void GUIFormSpecMenu::drawMenu()
bool hovered_element_found = false;

if (hovered != NULL) {
s32 id = hovered->getID();
if (m_show_debug) {
core::rect<s32> rect = hovered->getAbsoluteClippingRect();
driver->draw2DRectangle(0x22FFFF00, rect, &rect);
}

s32 id = hovered->getID();
u64 delta = 0;
if (id == -1) {
m_old_tooltip_id = id;
@@ -3903,6 +3907,10 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
(kp == getKeySetting("keymap_screenshot"))) {
m_client->makeScreenshot();
}

if (event.KeyInput.PressedDown && kp == getKeySetting("keymap_toggle_debug"))
m_show_debug = !m_show_debug;

if (event.KeyInput.PressedDown &&
(event.KeyInput.Key==KEY_RETURN ||
event.KeyInput.Key==KEY_UP ||
1 change: 1 addition & 0 deletions src/gui/guiFormSpecMenu.h
Original file line number Diff line number Diff line change
@@ -343,6 +343,7 @@ class GUIFormSpecMenu : public GUIModalMenu
u16 m_formspec_version = 1;
std::string m_focused_element = "";
JoystickController *m_joystick;
bool m_show_debug = false;

typedef struct {
bool explicit_size;

0 comments on commit 6cf15cf

Please sign in to comment.