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

Method SetKeyEventNativeData

tutorials/common/imgui/imgui.cpp:1387–1407  ·  view source on GitHub ↗

[Optional] Call after AddKeyEvent(). Specify native keycode, scancode + Specify index for legacy <1.87 IsKeyXXX() functions with native indices. If you are writing a backend in 2022 or don't use IsKeyXXX() with native values that are not ImGuiKey values, you can avoid calling this.

Source from the content-addressed store, hash-verified

1385// Specify native keycode, scancode + Specify index for legacy <1.87 IsKeyXXX() functions with native indices.
1386// If you are writing a backend in 2022 or don't use IsKeyXXX() with native values that are not ImGuiKey values, you can avoid calling this.
1387void ImGuiIO::SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index)
1388{
1389 if (key == ImGuiKey_None)
1390 return;
1391 IM_ASSERT(ImGui::IsNamedKey(key)); // >= 512
1392 IM_ASSERT(native_legacy_index == -1 || ImGui::IsLegacyKey((ImGuiKey)native_legacy_index)); // >= 0 && <= 511
1393 IM_UNUSED(native_keycode); // Yet unused
1394 IM_UNUSED(native_scancode); // Yet unused
1395
1396 // Build native->imgui map so old user code can still call key functions with native 0..511 values.
1397#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
1398 const int legacy_key = (native_legacy_index != -1) ? native_legacy_index : native_keycode;
1399 if (!ImGui::IsLegacyKey((ImGuiKey)legacy_key))
1400 return;
1401 KeyMap[legacy_key] = key;
1402 KeyMap[key] = legacy_key;
1403#else
1404 IM_UNUSED(key);
1405 IM_UNUSED(native_legacy_index);
1406#endif
1407}
1408
1409// Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen.
1410void ImGuiIO::SetAppAcceptingEvents(bool accepting_events)

Callers 1

Calls 2

IsNamedKeyFunction · 0.85
IsLegacyKeyFunction · 0.85

Tested by

no test coverage detected