Walnut icon indicating copy to clipboard operation
Walnut copied to clipboard

Feature Request: Expose GLFWwindow handle or otherwise allow means of registering certain callbacks

Open Mikewando opened this issue 3 years ago • 2 comments

For example I want to handle drag & drop events in my app. This is easy to do with GLFW by calling glfwSetDropCallback(handle, callback). But the window handle isn't currently exposed so modifying Application.cpp is necessary.

If it's undesirable to expose GLFW I'd be fine with some other abstraction for setting the drop callback.

Mikewando avatar May 18 '22 21:05 Mikewando

I recently used this framework to implement an application that uses the implot Immediate Mode Plotting library:

https://github.com/epezent/implot

I had to modify the Application.cpp file to create and destroy an ImPlot context inside of the ImGui::CreateContext / ImGui::DestroyContext:

Integration

  1. Set up an ImGui environment if you don't already have one.
  2. Add implot.h, implot_internal.h, implot.cpp, implot_items.cpp and optionally implot_demo.cpp to your sources. Alternatively, you can get ImPlot using vcpkg.
  3. Create and destroy an ImPlotContext wherever you do so for your ImGuiContext:

ImGui::CreateContext(); ImPlot::CreateContext(); ... ImPlot::DestroyContext(); ImGui::DestroyContext();

StevenJAckerman avatar May 18 '22 22:05 StevenJAckerman

just modify the source code to expose whatever you need, it's an MIT license after all...

Etaash-mathamsetty avatar Aug 21 '22 21:08 Etaash-mathamsetty