Fixed ImGui text input, and other trivial issues. (#4058)

This commit is contained in:
Branimir Karadžić
2026-10-16 16:32:59 -07:00
committed by GitHub
parent 25cd95ca06
commit fa2d4b56f3
15 changed files with 151 additions and 225 deletions

View File

@@ -450,10 +450,11 @@ public:
const double toMs = 1000.0/freq;
m_deltaTimeNs += frameTime*1000000/hpFreq;
++m_numFrames;
if (m_deltaTimeNs > 1000000)
{
m_deltaTimeAvgNs = m_deltaTimeNs / bx::max<int64_t>(1, m_numFrames);
m_deltaTimeAvgNs = m_deltaTimeNs / m_numFrames;
if (m_autoAdjust)
{
@@ -470,10 +471,6 @@ public:
m_deltaTimeNs = 0;
m_numFrames = 0;
}
else
{
++m_numFrames;
}
imguiBeginFrame(m_mouseState.m_mx
, m_mouseState.m_my

View File

@@ -558,6 +558,13 @@ struct OcornutImguiContext
io.AddKeyEvent(m_keyMap[ii], inputGetKeyState(entry::Key::Enum(ii) ) );
io.SetKeyEventNativeData(m_keyMap[ii], 0, 0, ii);
}
for (const uint8_t* utf8 = inputGetChar(); NULL != utf8; utf8 = inputGetChar() )
{
uint32_t ch;
ImTextCharFromUtf8(&ch, (const char*)utf8, (const char*)utf8 + 4);
io.AddInputCharacter(ch);
}
#endif // USE_ENTRY
ImGui::NewFrame();
@@ -613,7 +620,7 @@ void imguiDestroy()
void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, int _inputChar, bgfx::ViewId _viewId)
{
s_ctx.beginFrame(_mx, _my, _button, _scroll, _width, _height, _inputChar, bx::min(_viewId, bgfx::getCaps()->limits.maxViews-1) );
s_ctx.beginFrame(_mx, _my, _button, _scroll, _width, _height, _inputChar, bgfx::ViewId(bx::min<uint32_t>(_viewId, bgfx::getCaps()->limits.maxViews-1) ) );
}
void imguiEndFrame()

View File

@@ -1650,8 +1650,8 @@ void fonsDeleteInternal(FONScontext* stash)
if (stash->fonts) free(stash->fonts);
if (stash->texData) free(stash->texData);
if (stash->scratch) free(stash->scratch);
free(stash);
fons__tt_done(stash);
free(stash);
}
void fonsSetErrorCallback(FONScontext* stash, void (*callback)(void* uptr, int error, int val), void* uptr)