Updated imgui to v1.91.8-docking.

This commit is contained in:
Martin Felis
2025-02-16 16:08:20 +01:00
parent 45d56dea0d
commit 589b45554f
190 changed files with 37045 additions and 9265 deletions
+7 -35
View File
@@ -4,6 +4,7 @@
// texture or custom font support).
//------------------------------------------------------------------------------
#include "backends/imgui_impl_glfw.h"
#include "imgui.h"
#include "imnodes.h"
#define SOKOL_IMPL
@@ -480,20 +481,9 @@ int main() {
glfwSetScrollCallback(w, [](GLFWwindow*, double /*pos_x*/, double pos_y) {
ImGui::GetIO().MouseWheel = float(pos_y);
});
glfwSetKeyCallback(
w,
[](GLFWwindow*, int key, int /*scancode*/, int action, int mods) {
ImGuiIO& io = ImGui::GetIO();
if ((key >= 0) && (key < 512)) {
io.KeysDown[key] = (action == GLFW_PRESS) || (action == GLFW_REPEAT);
}
io.KeyCtrl = (0 != (mods & GLFW_MOD_CONTROL));
io.KeyAlt = (0 != (mods & GLFW_MOD_ALT));
io.KeyShift = (0 != (mods & GLFW_MOD_SHIFT));
});
glfwSetCharCallback(w, [](GLFWwindow*, unsigned int codepoint) {
ImGui::GetIO().AddInputCharacter((ImWchar)codepoint);
});
glfwSetKeyCallback(w, ImGui_ImplGlfw_KeyCallback);
glfwSetCharCallback(w, ImGui_ImplGlfw_CharCallback);
// setup sokol_gfx and sokol_time
stm_setup();
@@ -551,24 +541,6 @@ int main() {
14,
&font_config);
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;
// ImNodes
ImNodes::CreateContext();
@@ -752,7 +724,7 @@ int main() {
camera_accel);
}
ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport());
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("File")) {
@@ -1256,7 +1228,7 @@ void draw_imgui(ImDrawData* draw_data) {
pcmd.UserCallback(cl, &pcmd);
} else {
uint32_t prev_fs_image_id = bind.fs_images[0].id;
if (pcmd.TextureId != nullptr) {
if (pcmd.TextureId != 0) {
bind.fs_images[0].id = (uint32_t)(uintptr_t)pcmd.TextureId;
sg_apply_bindings(&bind);
}
@@ -1268,7 +1240,7 @@ void draw_imgui(ImDrawData* draw_data) {
sg_apply_scissor_rect(scissor_x, scissor_y, scissor_w, scissor_h, true);
sg_draw(base_element, pcmd.ElemCount, 1);
if (pcmd.TextureId != nullptr) {
if (pcmd.TextureId != 0) {
bind.fs_images[0].id = prev_fs_image_id;
sg_apply_bindings(&bind);
}