diff --git a/README.md b/README.md deleted file mode 100644 index 642ed45..0000000 --- a/README.md +++ /dev/null @@ -1,60 +0,0 @@ -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 - - - [**GLFW v3**](https://github.com/glfw/glfw/releases): used as rendering backend. Executable in releases is compiled with version [`3.3.8`](https://github.com/glfw/glfw/releases/tag/3.3.8). - - Compiled with `clang` using [**llvm-mingw 20220906**](https://github.com/mstorsjo/llvm-mingw/releases/tag/20220906). - -## 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. diff --git a/filepicker.hpp b/filepicker.hpp index 6d0f1d5..2e5f8a4 100644 --- a/filepicker.hpp +++ b/filepicker.hpp @@ -126,7 +126,7 @@ enum WindowFlags { FP_DIRECTORY_SELECT = (1<<4) }; -enum ExitFlags { +enum exitFlags { EXIT_CONTINUE = (1<<0), EXIT_SELECTED = (1<<1), EXIT_CLOSED = (1<<2), @@ -762,14 +762,14 @@ int windowRendering(wchar_t* userPath, bool* windowOpen, int windowFlags = 0){ if(ImGui::Button("Select")) { log_wdebugcpp(chosenPath << " TRIED TO RETURN"); ImGui::End(); - return exitWindow(userPath, windowOpen, ExitFlags::EXIT_SELECTED); + return exitWindow(userPath, windowOpen, exitFlags::EXIT_SELECTED); } //listFlags = handleFolderAccessResult(listFlags, addrBarVal, &showError, error, ErrorMessages::addrBarError, history, currentPath, addrBarVal); ImGui::End(); if(windowOpen) return EXIT_CONTINUE; - else return exitWindow(userPath, windowOpen, ExitFlags::EXIT_CLOSED); + else return exitWindow(userPath, windowOpen, exitFlags::EXIT_CLOSED); }