get rid of NFD dependency since im using SDL3 and its builtin functionality

This commit is contained in:
irisz64
2025-07-22 12:47:31 +02:00
parent 3520a309ed
commit 4bcfd18d0b
53 changed files with 39 additions and 8093 deletions

View File

@@ -1,5 +1,4 @@
#include <SettingsWindow.hpp>
#include <nfd.hpp>
#include <log.hpp>
#include <Options.hpp>
#include <imgui.h>
@@ -20,18 +19,22 @@ bool SettingsWindow::render() {
if(ImGui::BeginTabItem("General")) {
if(ImGui::Button("Pick...")) {
NFD::Guard guard;
NFD::UniquePath outPath;
SDL_ShowOpenFolderDialog([](void *userdata, const char * const *filelist, int filter) {
SettingsWindow* settings = (SettingsWindow*)userdata;
if (!filelist) {
panic("An error occured: %s", SDL_GetError());
return;
} else if (!*filelist) {
warn("The user did not select any file.");
warn("Most likely, the dialog was canceled.");
return;
}
auto result = NFD::PickFolder(outPath);
if(result == NFD_ERROR)
panic("Error: {}", NFD::GetError());
if(result != NFD_CANCEL) {
savesPath = outPath.get();
Options::GetInstance().SetValue<std::string>("general", "savePath", savesPath);
applyEnabled = true;
}
settings->savesPath = *filelist;
Options::GetInstance().SetValue<std::string>("general", "savePath", settings->savesPath);
settings->applyEnabled = true;
}, this, window.getHandle(), nullptr, false);
}
ImGui::SameLine();
ImGui::BeginDisabled();