Nav: Examples: DirectX11, Glfw+GL3: Basic code to map keyboard inputs when io.NavFlags & ImGuiNavFlags_EnableKeyboard is set. (will iterate/tweak before spreading to other examples). (#787)
// FIXME-NAV: We are still using some of the ImGuiNavInput_PadXXX enums as keyboard support is incomplete.
#define MAP_KEY(NAV_NO, KEY_NO) { if (io.KeysDown[KEY_NO]) io.NavInputs[NAV_NO] = 1.0f; }
MAP_KEY(ImGuiNavInput_KeyLeft,VK_LEFT);
MAP_KEY(ImGuiNavInput_KeyRight,VK_RIGHT);
MAP_KEY(ImGuiNavInput_KeyUp,VK_UP);
MAP_KEY(ImGuiNavInput_KeyDown,VK_DOWN);
MAP_KEY(ImGuiNavInput_KeyMenu,VK_MENU);
MAP_KEY(ImGuiNavInput_PadActivate,VK_SPACE);
MAP_KEY(ImGuiNavInput_PadCancel,VK_ESCAPE);
MAP_KEY(ImGuiNavInput_PadInput,VK_RETURN);
MAP_KEY(ImGuiNavInput_PadTweakFast,VK_SHIFT);
MAP_KEY(ImGuiNavInput_PadTweakSlow,VK_CONTROL);
#undef MAP_KEY
}
// Set OS mouse position if requested last frame by io.WantMoveMouse flag (used when io.NavMovesTrue is enabled by user and using directional navigation)
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
// - Read 'extra_fonts/README.txt' for more instructions and details.
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
// Start the frame. This call will update the io.WantCaptureMouse, io.WantCaptureKeyboard flag that you can use to dispatch inputs (or not) to your application.
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
// - Read 'extra_fonts/README.txt' for more instructions and details.
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !