Single-header file picker library for ImGui. Currently, this library is Windows-only. Support for Linux is planned. # How to use This library exposes three functions: ``` void renderFilePicker(char* userPath, bool* windowOpen, bool* memoryFreed, int windowFlags); ``` Call this function within the render loop providing a pre-allocated buffer of MAX_PATH characters in `userPath`, which will be filled with a UTF-8 string. `windowOpen` must be initially set to `true`, and will set itself to `false` when execution is done. If succesful, your buffer will contain a valid path. `memoryFreed` will be set to `true`, and must be checked once the window is closed to free memory resources acquired by this library. You can provide `windowFlags` to customize its appearance. ### Window customization flags ``` fp::WindowFlags::FULLSCREEN : Render window in full screen, without decorations. ``` ``` void freeMemory(bool* memoryFreed); ``` Memory resources will be deallocated alongside miscellaneous internal tasks, and `memoryFreed` will be set to `true`. ``` void setDebugInfo(int debugVerbosity); ``` When `FPDEBUG` is enabled, this allows you to configure debug granularity. ### Debug flags ``` fp::DebugVerbosity::DIRECTORY fp::DebugVerbosity::VOLUME fp::DebugVerbosity::EXTENSION ``` # Library dependencies - **C++ STL**: This library uses `vector`, `fill` and `w\string`. # Demo build instructions ## Build requirements - [**GLFW v3**](https://github.com/glfw/glfw/releases): used as rendering backend. Executable in releases is compiled with version [`3.3.9`](https://github.com/glfw/glfw/releases/tag/3.3.9). - Developed and tested with `clang` using [**llvm-mingw 20220906**](https://github.com/mstorsjo/llvm-mingw/releases/tag/20220906). Any `MinGW`-backed `clang` compiler should work, but your mileage may vary. ## How to compile Download GLFW and pick your libraries according to your toolchain. Then, call your compiler directly specifying both libs needed and your paths to the necessary header and lib files: ``` clang++ demo/main.cpp -o demo/demo.exe -L C:/pathtollvmmingw/x86_64-w64-mingw32/bin -I C:\pathtollvmmingw\include -L C:/pathtoglfw/lib-mingw-w64 -I C:\pathtoglfw\include -lglfw3 -l libc++ ``` If you want to statically link: ``` clang++ demo/main.cpp -o demo/demo.exe -L C:/pathtoglfw/lib-mingw-w64 -L C:/pathtollvmmingw/x86_64-w64-mingw32/lib -I C:\pathtollvmmingw\include -I C:\pathtoglfw\include -std=c++17 -stdlib=libc++ -rtlib=compiler-rt -static -l glfw3 -l gdi32 -l opengl32 -l user32 -l kernel32 -static-libstdc++ ``` # To-Dos - Implement a file watcher to check for changes on the current directory. - Add Linux support. - Allow users to provide their own memory allocations as an option.