MCPcopy Create free account
hub / github.com/RenderKit/embree / AddInputCharacter

Method AddInputCharacter

tutorials/common/imgui/imgui.cpp:1225–1237  ·  view source on GitHub ↗

Pass in translated ASCII characters for text input. - with glfw you can get those from the callback set in glfwSetCharCallback() - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API

Source from the content-addressed store, hash-verified

1223// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
1224// FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API
1225void ImGuiIO::AddInputCharacter(unsigned int c)
1226{
1227 ImGuiContext& g = *GImGui;
1228 IM_ASSERT(&g.IO == this && "Can only add events to current context.");
1229 if (c == 0 || !AppAcceptingEvents)
1230 return;
1231
1232 ImGuiInputEvent e;
1233 e.Type = ImGuiInputEventType_Text;
1234 e.Source = ImGuiInputSource_Keyboard;
1235 e.Text.Char = c;
1236 g.InputEventsQueue.push_back(e);
1237}
1238
1239// UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so
1240// we should save the high surrogate.

Callers 1

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected