Single-header file picker library for ImGui.
Find a file
2024-01-16 18:24:26 +01:00
demo demo source cleanup 2024-01-16 18:24:25 +01:00
imgui@5ac94ad898 First Commit. Primera ventana 2022-10-24 16:47:55 +02:00
.gitignore pequeños bugixes; debug facherito 2024-01-16 18:24:23 +01:00
.gitmodules First Commit. Primera ventana 2022-10-24 16:47:55 +02:00
filepicker.hpp Add README.md 2024-01-16 18:24:26 +01:00
README.md Add README.md 2024-01-16 18:24:26 +01:00

Single-header file picker Windows library for ImGui.

How to use

int renderFilePicker(wchar_t* userPath, bool* windowOpen, int windowFlags = 0) {

Call int fp::renderFilePicker(wchar_t* userPath, bool* windowOpen, int windowFlags = 0); within the render loop providing a pre-allocated C-string buffer of MAX_PATH characters in userPath. 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. You can check the file picker state each frame by parsing this function's return value. You can provide windowFlags to customize its appearance.

Window states

	- fp::ExitFlags::EXIT_CONTINUE : Window will render next frame. 
	- fp::ExitFlags::EXIT_SELECTED : A path has been successfully returned, window will close.
	- fp::ExitFlags::EXIT_CLOSED   : User has closed the window. No path is returned.
	- fp::ExitFlags::EXIT_ERROR    : An unexpected error has ocurred. No path is returned.

Valid window flags

   - fp::WindowFlags::FP_FULLSCREEN`: Render window in full screen, without decorations.

Library dependencies

  • C++ STL: This library uses vector and w\string.

Build considerations

Define DEBUG to print relevant information to the console.

Demo build instructions

Build requirements

How to compile

Download GLFW and pick your libraries according to your toolchain(mingw-w64 in this example).

Then, call your compiler directly (clang is demonstrated here) 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/si.exe -DDEBUG -L C:\capybara\libclang\x86_64-w64-mingw32\bin -L C:\capybara\libclang\x86_64-w64-mingw32\lib -I C:\capybara\libclang\include -std=c++17 -lglfw3 -l opengl32 -l gdi32 -l user32 -l kernel32 -l imm32 -static-libstdc++  --verbose

Add -DDEBUG to print filepicker's debug information, if you so desire.

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.