From 6193299dfbfc64c24d3b74ac83ba2f6aed229346 Mon Sep 17 00:00:00 2001 From: Michael Yick Date: Sun, 4 Feb 2024 22:47:17 -0600 Subject: [PATCH] Actually write the damn tool --- .gitignore | 3 +++ .gitmodules | 3 +++ Makefile | 8 ++++++++ README.md | 5 +++-- renpy-filepicker-reader.c | 14 ++++++++++++++ renpy-filepicker-saver.c | 12 ++++++++++++ tinyfiledialogs | 1 + 7 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 100644 Makefile create mode 100644 renpy-filepicker-reader.c create mode 100644 renpy-filepicker-saver.c create mode 160000 tinyfiledialogs diff --git a/.gitignore b/.gitignore index cd531cf..a35cd49 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ Module.symvers Mkfile.old dkms.conf +# outputs +reader +saver diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0b46af6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tinyfiledialogs"] + path = tinyfiledialogs + url = https://git.code.sf.net/p/tinyfiledialogs/code diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1f9c3d1 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +CC = gcc + +build: + $(CC) renpy-filepicker-saver.c tinyfiledialogs/tinyfiledialogs.c -o saver + $(CC) renpy-filepicker-reader.c tinyfiledialogs/tinyfiledialogs.c -o reader + +clean: + rm -vf saver reader diff --git a/README.md b/README.md index b099c84..4567b20 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # renpy-filepicker ->current year ->ren'py doesn't have a file picker \ No newline at end of file +>current year + +>ren'py doesn't have a file picker diff --git a/renpy-filepicker-reader.c b/renpy-filepicker-reader.c new file mode 100644 index 0000000..91215b9 --- /dev/null +++ b/renpy-filepicker-reader.c @@ -0,0 +1,14 @@ +#include +#include "./tinyfiledialogs/tinyfiledialogs.h" + +int main () { + char const * imageFilterPatterns[2] = {"*.png", "*.jpg"}; + char* filename = tinyfd_openFileDialog("Please select an image", + "", + 2, + imageFilterPatterns, + "Image Files", + 0); + + printf("%s\n", filename); +} diff --git a/renpy-filepicker-saver.c b/renpy-filepicker-saver.c new file mode 100644 index 0000000..32cb859 --- /dev/null +++ b/renpy-filepicker-saver.c @@ -0,0 +1,12 @@ +#include +#include "./tinyfiledialogs/tinyfiledialogs.h" + +int main () { + char* filename = tinyfd_saveFileDialog("Please select an export location", + "wani-export.zip", + 0, + NULL, + NULL); + + printf("%s\n", filename); +} diff --git a/tinyfiledialogs b/tinyfiledialogs new file mode 160000 index 0000000..e60005e --- /dev/null +++ b/tinyfiledialogs @@ -0,0 +1 @@ +Subproject commit e60005e2592f13c22dbad8100de66f6dfa0d0d7c