(Don't merge) Tests/Demos
diff --git a/examples/example_allegro5/main.cpp b/examples/example_allegro5/main.cpp
index 4fd379a..b2483c0 100644
--- a/examples/example_allegro5/main.cpp
+++ b/examples/example_allegro5/main.cpp
@@ -101,6 +101,11 @@
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
+ ImGui::Text("IsKeyDown(ALLEGRO_KEY_SPACE) = %d", ImGui::IsKeyDown(ALLEGRO_KEY_SPACE));
+ ImGui::Text("IsKeyDown(ALLEGRO_KEY_P) = %d", ImGui::IsKeyDown(ALLEGRO_KEY_P));
+ ImGui::Text("IsKeyDown(ImGuiKey_Space) = %d", ImGui::IsKeyDown(ImGuiKey_Space));
+ ImGui::Text("IsKeyDown(ImGuiKey_P) = %d", ImGui::IsKeyDown(ImGuiKey_P));
+
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index f8e8a02..b5c4c95 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -122,6 +122,11 @@
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
+ ImGui::Text("IsKeyDown(GLFW_KEY_SPACE) = %d", ImGui::IsKeyDown(GLFW_KEY_SPACE));
+ ImGui::Text("IsKeyDown(GLFW_KEY_P) = %d", ImGui::IsKeyDown(GLFW_KEY_P));
+ ImGui::Text("IsKeyDown(ImGuiKey_Space) = %d", ImGui::IsKeyDown(ImGuiKey_Space));
+ ImGui::Text("IsKeyDown(ImGuiKey_P) = %d", ImGui::IsKeyDown(ImGuiKey_P));
+
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
diff --git a/examples/example_glut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp
index fed62b5..200a1d5 100644
--- a/examples/example_glut_opengl2/main.cpp
+++ b/examples/example_glut_opengl2/main.cpp
@@ -45,6 +45,12 @@
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
+ ImGui::Text("IsKeyDown(' ') = %d", ImGui::IsKeyDown(' '));
+ ImGui::Text("IsKeyDown('p') = %d", ImGui::IsKeyDown('p'));
+ ImGui::Text("IsKeyDown('P') = %d", ImGui::IsKeyDown('P'));
+ ImGui::Text("IsKeyDown(ImGuiKey_Space) = %d", ImGui::IsKeyDown(ImGuiKey_Space));
+ ImGui::Text("IsKeyDown(ImGuiKey_P) = %d", ImGui::IsKeyDown(ImGuiKey_P));
+
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index a7e7fc0..d0daddb 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -130,6 +130,11 @@
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
+ ImGui::Text("IsKeyDown(SDLK_SPACE) = %d", ImGui::IsKeyDown(SDLK_SPACE));
+ ImGui::Text("IsKeyDown(SDLK_p) = %d", ImGui::IsKeyDown(SDLK_p));
+ ImGui::Text("IsKeyDown(ImGuiKey_Space) = %d", ImGui::IsKeyDown(ImGuiKey_Space));
+ ImGui::Text("IsKeyDown(ImGuiKey_P) = %d", ImGui::IsKeyDown(ImGuiKey_P));
+
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
diff --git a/examples/example_win32_directx11/main.cpp b/examples/example_win32_directx11/main.cpp
index 7f1b4b8..11e753e 100644
--- a/examples/example_win32_directx11/main.cpp
+++ b/examples/example_win32_directx11/main.cpp
@@ -113,6 +113,11 @@
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
+ ImGui::Text("IsKeyDown(VK_SPACE) = %d", ImGui::IsKeyDown(VK_SPACE));
+ ImGui::Text("IsKeyDown(VK_P) = %d", ImGui::IsKeyDown('P'));
+ ImGui::Text("IsKeyDown(ImGuiKey_Space) = %d", ImGui::IsKeyDown(ImGuiKey_Space));
+ ImGui::Text("IsKeyDown(ImGuiKey_P) = %d", ImGui::IsKeyDown(ImGuiKey_P));
+
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index 1c13bc4..24e1da9 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -5662,6 +5662,7 @@
}
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus");
+ ImGui::SetNextItemOpen(true);
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
{
ImGuiIO& io = ImGui::GetIO();
@@ -5695,6 +5696,7 @@
// Display Keyboard/Mouse state
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard & Navigation State");
+ ImGui::SetNextItemOpen(true);
if (ImGui::TreeNode("Keyboard & Navigation State"))
{
// We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allow displaying the data for old/new backends.
@@ -5704,6 +5706,7 @@
#else
struct funcs { static bool IsNativeDupe(ImGuiKey key) { return key < ImGuiKey_LegacyNativeKey_END && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array
#endif
+ //ImGui::Text("Raw down:"); for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) { ImGuiKey key = (ImGuiKey)i; if (io.KeysData[i].Down) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (0x%X) (%.02f secs)", ImGui::GetKeyName(key), key, key, ImGui::GetKeyData(key)->DownDuration); } }
ImGui::Text("Keys down:"); for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) { ImGuiKey key = (ImGuiKey)(i + ImGuiKey_KeysData_OFFSET); if (funcs::IsNativeDupe(key)) continue; if (ImGui::IsKeyDown(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (0x%X) (%.02f secs)", ImGui::GetKeyName(key), key, key, ImGui::GetKeyData(key)->DownDuration); } }
ImGui::Text("Keys pressed:"); for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) { ImGuiKey key = (ImGuiKey)(i + ImGuiKey_KeysData_OFFSET); if (funcs::IsNativeDupe(key)) continue; if (ImGui::IsKeyPressed(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (0x%X)", ImGui::GetKeyName(key), key, key); } }
ImGui::Text("Keys released:"); for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) { ImGuiKey key = (ImGuiKey)(i + ImGuiKey_KeysData_OFFSET); if (funcs::IsNativeDupe(key)) continue; if (ImGui::IsKeyReleased(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (0x%X)", ImGui::GetKeyName(key), key, key); } }