britzl / extension-imgui

Dear ImGUI extension for Defold
MIT License
58 stars 19 forks source link

Add Netimgui support #33

Closed dri-richard closed 11 months ago

dri-richard commented 1 year ago

I'm not expecting this to be merged as-is, but maybe to start discussion.

This PR adds support for netimgui, by adding the netimgui client libraries and disabling direct rendering and input if a netimgui server is connected. This allows imgui content to be displayed and interacted with in a separate window, and also from a separate host computer. This is particularly useful on mobile, where screen space is limited and interactions are fiddly.

Tab1 in the example has options to connect to a specified Netimgui server application, or to wait for a connection from any server. This way, the netimgui support makes no difference to existing applications unless a connection method is explicitly enabled.

The Netimgui distribution only includes a Windows build process (using Sharpmake to generate VS project files), but I've built the server app for macOS with CMake, and will try later to create an Xcode project with Sharpmake which is more likely to be accepted as a PR by the project maintainer.

image

britzl commented 1 year ago

Pretty cool to be honest! I've been thinking a bit about how to use various Dear ImGUI widgets and plugins and I believe that the best option is to create them as separate extensions. I think you could do this here as well. We just need to add a way for extension-netimgui to modify the static void imgui_NewFrame() function to call NetImgui::NewFrame(); instead of Imgui::NewFrame();