mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-10-25 02:10:51 +00:00
Fixed ImGui text input, and other trivial issues. (#4058)
This commit is contained in:
committed by
GitHub
parent
25cd95ca06
commit
fa2d4b56f3
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user