pawbyte / Game-Pencil-Engine-Editor

Game Pencil Engine a game engine written from the ground up.
https://gamepencil.net/
MIT License
100 stars 20 forks source link

libfiledialogs Git Submodule (Optional Dear ImGui File Dialogs Dependency) #78

Open time-killer-games opened 1 year ago

time-killer-games commented 1 year ago

what my thought on this was, it won't actually go inside your repository as a git submodule it will be optional they will have to specify git clone --recurse-submodules without --recurse-submodules it can use dlgmodule or tiny file dialogs or whatever you prefer as the fallback the executable will look in its working directory for the dll and if it exists override the dialogs with the imgui ones if the dll isn't found on the filesystem, don't attempt to call functions from nonexistent dll and then use the fallback you already have in your repos it won't require much code added to your codebase what do you think? having it as a submodule will allow you to maintain your ide how you like and i can maintain my dialogs with my own write access without directly affecting you upon breakages for example people can use yours if mine breaks or vise versa the most compelling reason for this to be added is less maintenance needed for building on mac mac is currently broken with dlgmod and will likely break after i fix it, just a matter of yearly os updates as for the imgui dialogs it relies on code that apple rarely changes in my experience even then i can reimport a newer version of imgui if stuff breaks and let the imgui devs fix things for me ok so ill make a pull request but before that ill write a pseudo code real quick to give you a better idea

string get_open_filename(filter, fname) {
  if (file_exists(libfiledialogs_dll_file)) {
    return call_dll(libfiledialogs_dll_file, "get_open_filename", filter, fname);
  }
  // existing code from dlgmodule here
}

basically that for each dialog function 2-3 lines each of course, not counting the helper function for call_dll that's just a helper function wrapping dlopen(), dlsym(), and dlclose() on unix-likes and LoadLibraryW() for win32

dlopen(), dlsym() dlclose() docs - https://man7.org/linux/man-pages/man3/dlopen.3.html LoadLibraryW() docs - https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryw the dialogs are fully customizeable you can set the localization, button text, title bar text, set them to borderless, parent window, always on top (when there is no parent), fullscreen, fixed, sizeable, change theme just to name a few of the features already in the library doesn't just do file dialogs and also message boxes and i will also add input box, login box, color picker and other stuff in the future

libfiledialogs library repos: https://github.com/time-killer-games/libfiledialogs

Preview:

207476087-f0f98e0e-2d60-465d-aa78-47cbe9d1f343

Motivation:

primarily to have consistent looking dialogs for every platform while also ensuring macos support goes stale less often as imgui devs will handle most of the required maintenance for us, because in my experience of working with macOS's native dialogs they need to have code maintained nearly every year because os upgrades keep on breaking dlgmodule's code. This also opens the door to unofficially supporting DragonFly BSD, NetBSD, OpenBSD, and SunOS variants which are currently not supported by the version of dlgmodule used in the GPE IDE repos.

Additional Notes:

nhurde commented 6 months ago

Adding to Fall 2024 due to backlog priority.