emote2ss

Animated webp to spritesheets converting tool
git clone git://bsandro.tech/emote2ss
Log | Files | Refs | README | LICENSE

commit 540f40220ae4f484b1e5f6d5a77f514b86b40eb1
parent f139219eb3f4a99ff3716ac8bb16e96cd0a296b5
Author: bsandro <[email protected]>
Date:   Fri, 13 Sep 2024 00:39:08 +0300

Readme fixes

Diffstat:
MREADME | 15++++++++-------
Mcli/Makefile | 4----
Mgui/main.c | 24+++++++++---------------
3 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/README b/README @@ -2,20 +2,21 @@ emote2ss = 'Emote to SpriteSheet' utility. License: BSD 2-Clause. -Simple tool to expand a given animated .webp into a spritesheet of given columns count wide. +Simple tool to expand a given animated .webp into a spritesheet of given columns count-wide. -At this moment command-line only, cross-platform GUI is the next step planned. +There is a GUI version with a preview of the output sprite and a command-line utility that you can pass the column count as a command-line argument. -Usage: +CLI Usage: `emote2ss file.webp COLUMNS`, e.g. `emote2ss MyAnimationFile.webp 10` - expands animated file into a spritesheet of 10 frames wide. The output file is named the same as the source with the prefix "atlas_", e.g. FlanClap.webp produces atlas_FlanClap.webp Dependencies: Libraries: libwebp and libwebpdemux. -Optional tools: feh +Bundled GUI toolkit: luigi - https://github.com/nakst/luigi Building: Only libraries above, C99 compiler, standard pkg-config and GNU Makefile are needed. -To build simply run `make`. +I've tested builds for GNU/Linux, OpenBSD and macOS. +To build on Windows platform change '-DUI_LINUX' to '-DUI_WINDOWS' in gui/Makefile. -There is a small testcase to verify everything working properly: -`make test` - it builds the utility and runs it against bundled "FlanClap.webp" animation, and then tries to launch `feh` to preview the resulting image. +To build GUI tool run `make gui`. +To build CLI tool run `make cli` diff --git a/cli/Makefile b/cli/Makefile @@ -21,7 +21,3 @@ $(NAME): $(OBJ) run: $(NAME) ../$(NAME) - -test: $(NAME) - ../$(NAME) ../FlanClap.webp 7 - feh atlas_FlanClap.webp diff --git a/gui/main.c b/gui/main.c @@ -210,16 +210,6 @@ int ButtonDialogOpenEvent(UIElement *element, UIMessage msg, int di, void *dp) { return 0; } -/* -@todo -- display/update resulting spritesheet dimensions in pixels -- unify path and filename fields (more canonical way) -- `-> copy the full path+name into the unified field -- use system open/save dialog on Windows -- move the whole subroutine into a separate file -- prohibit interaction with parent window - */ - static int FilelistFilter(const struct dirent *f) { if (strncmp(f->d_name, ".", 255)==0) return 0; if (f->d_type==DT_DIR) return 1; @@ -267,10 +257,9 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) { strcpy(newpath, element->cp); strcat(newpath, "/"); strcat(newpath, filelist[hit]->d_name); - //element->cp = realpath(filelist[hit]->d_name, NULL); - //@todo memory leak + free(element->cp); element->cp = realpath(newpath, NULL); - //@todo cleanup filelist! + //free(filelist); filelist = NULL; selected = -1; //@todo duplicated code @@ -295,7 +284,6 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) { UIPanel *panel_top = (UIPanel *)label->e.next; UITextbox *path_input = (UITextbox *)panel_top->e.children; UITextbox *file_input = (UITextbox *)path_input->e.next; - // string, bytes, UITextboxReplace UITextboxClear(path_input, false); UITextboxClear(file_input, false); UITextboxReplace(path_input, (char *)element->cp, -1, false); @@ -305,6 +293,8 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) { } } } else if (msg==UI_MSG_DESTROY) { + printf("destroy\n"); + // free(filelist); filelist = NULL; selected = -1; } else if (msg==UI_MSG_UPDATE) { @@ -350,7 +340,11 @@ void ShowModalWindow(UIWindow *parent, const char *def_dir, const char *def_file UITable *table = UITableCreate(&panel_out->e, UI_ELEMENT_V_FILL, "Directory"); table->itemCount = 1; // at least '..' element - table->e.cp = "."; // initial directory + // @todo this way setting the initial directory is kinda trashcan + char *init_path = (char *)malloc(2*sizeof(char)); + init_path[0] = '.'; + init_path[1] = '\0'; + table->e.cp = (void *)init_path; table->e.messageUser = TableEvent; UITableResizeColumns(table); } else {