mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
IO: Added io.ClearEventsQueue(). Obsoleted io.ClearInputCharacters(). (#4921)
cc #2425 #1153 #1600
This commit is contained in:
parent
9a15730c2a
commit
6aa408c6af
3 changed files with 33 additions and 7 deletions
20
imgui.cpp
20
imgui.cpp
|
|
@ -1341,13 +1341,15 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Perhaps we could clear queued events as well?
|
||||
void ImGuiIO::ClearInputCharacters()
|
||||
// Clear all incoming events.
|
||||
void ImGuiIO::ClearEventsQueue()
|
||||
{
|
||||
InputQueueCharacters.resize(0);
|
||||
IM_ASSERT(Ctx != NULL);
|
||||
ImGuiContext& g = *Ctx;
|
||||
g.InputEventsQueue.clear();
|
||||
}
|
||||
|
||||
// FIXME: Perhaps we could clear queued events as well?
|
||||
// Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
||||
void ImGuiIO::ClearInputKeys()
|
||||
{
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
|
|
@ -1368,8 +1370,18 @@ void ImGuiIO::ClearInputKeys()
|
|||
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f;
|
||||
}
|
||||
MouseWheel = MouseWheelH = 0.0f;
|
||||
InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters().
|
||||
}
|
||||
|
||||
// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue.
|
||||
// Current frame character buffer is now also cleared by ClearInputKeys().
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
void ImGuiIO::ClearInputCharacters()
|
||||
{
|
||||
InputQueueCharacters.resize(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1)
|
||||
{
|
||||
ImGuiContext& g = *ctx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue