summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/editor.c8
-rw-r--r--src/main.c2
3 files changed, 10 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 098f963..4840d9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,13 +46,11 @@ FetchContent_MakeAvailable(raygui)
# nativefiledialog
FetchContent_Declare(
nfd
- GIT_REPOSITORY https://github.com/hjalleboii/nativefiledialog.git # TODO: change to the original repo later
+ GIT_REPOSITORY https://github.com/btzy/nativefiledialog-extended.git
GIT_TAG master
)
FetchContent_MakeAvailable(nfd)
-add_subdirectory(${nfd_SOURCE_DIR}/build/cmake ${CMAKE_BINARY_DIR}/nfd_build)
-
-target_include_directories(sillyeditor PRIVATE ${raygui_SOURCE_DIR}/src ${nfd_SOURCE_DIR}/src/include)
+target_include_directories(sillyeditor PRIVATE ${raygui_SOURCE_DIR}/src)
target_link_libraries(sillyeditor PRIVATE raylib m nfd)
diff --git a/src/editor.c b/src/editor.c
index 425dc64..c1d9463 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -236,8 +236,12 @@ void drawPreview(EditorCreateBlockState *state, int wx, int wy, int ww, int wh,
}
void loadTexture(EditorCreateBlockState *state) {
- nfdchar_t *outPath = NULL;
- nfdresult_t result = NFD_OpenDialog(NULL, NULL, &outPath);
+ nfdu8char_t *outPath;
+ nfdu8filteritem_t filters[1] = {{"Images", "png"}};
+ nfdopendialogu8args_t args = {0};
+ args.filterList = filters;
+ args.filterCount = 1;
+ nfdresult_t result = NFD_OpenDialogU8_With(&outPath, &args);
if (result == NFD_OKAY) {
if (!IsFileExtension(outPath, ".png")) {
diff --git a/src/main.c b/src/main.c
index 0bcfa9b..5ba9463 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,10 +5,12 @@
#include "editor.h"
#include "floor.h"
#include "logger.h"
+#include "nfd.h"
#include "raylib.h"
#include "tileset.h"
int main() {
+ NFD_Init();
SetTraceLogCallback(SE_Logger);
SetConfigFlags(FLAG_WINDOW_RESIZABLE);