show ui debug info inside editor

This commit is contained in:
dobrykafe 2024-10-02 21:25:24 +02:00
parent d3d4c187fb
commit 045738daf3
4 changed files with 7 additions and 4 deletions

View file

@ -2275,7 +2275,7 @@ void CMenus::OnRender()
// render debug information // render debug information
if(g_Config.m_Debug) if(g_Config.m_Debug)
Ui()->DebugRender(); Ui()->DebugRender(2.0f, Ui()->Screen()->h - 12.0f);
if(Ui()->ConsumeHotkey(CUi::HOTKEY_ESCAPE)) if(Ui()->ConsumeHotkey(CUi::HOTKEY_ESCAPE))
SetActive(false); SetActive(false);

View file

@ -258,13 +258,13 @@ void CUi::Update(vec2 MouseWorldPos)
m_ProgressSpinnerOffset = std::fmod(m_ProgressSpinnerOffset, 1.0f); m_ProgressSpinnerOffset = std::fmod(m_ProgressSpinnerOffset, 1.0f);
} }
void CUi::DebugRender() void CUi::DebugRender(float X, float Y)
{ {
MapScreen(); MapScreen();
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "hot=%p nexthot=%p active=%p lastactive=%p", HotItem(), NextHotItem(), ActiveItem(), m_pLastActiveItem); str_format(aBuf, sizeof(aBuf), "hot=%p nexthot=%p active=%p lastactive=%p", HotItem(), NextHotItem(), ActiveItem(), m_pLastActiveItem);
TextRender()->Text(2.0f, Screen()->h - 12.0f, 10.0f, aBuf); TextRender()->Text(X, Y, 10.0f, aBuf);
} }
bool CUi::MouseInside(const CUIRect *pRect) const bool CUi::MouseInside(const CUIRect *pRect) const

View file

@ -470,7 +470,7 @@ public:
void SetEnabled(bool Enabled) { m_Enabled = Enabled; } void SetEnabled(bool Enabled) { m_Enabled = Enabled; }
bool Enabled() const { return m_Enabled; } bool Enabled() const { return m_Enabled; }
void Update(vec2 MouseWorldPos = vec2(-1.0f, -1.0f)); void Update(vec2 MouseWorldPos = vec2(-1.0f, -1.0f));
void DebugRender(); void DebugRender(float X, float Y);
vec2 MousePos() const { return m_MousePos; } vec2 MousePos() const { return m_MousePos; }
float MouseX() const { return m_MousePos.x; } float MouseX() const { return m_MousePos.x; }

View file

@ -8777,6 +8777,9 @@ void CEditor::OnRender()
m_ShowMousePointer = true; m_ShowMousePointer = true;
} }
if(g_Config.m_Debug)
Ui()->DebugRender(2.0f, Ui()->Screen()->h - 27.0f);
Ui()->FinishCheck(); Ui()->FinishCheck();
Ui()->ClearHotkeys(); Ui()->ClearHotkeys();
Input()->Clear(); Input()->Clear();