emote2ss

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

commit bdd04b33076911856b3df7d330df882a98471ebe
parent 08c9c53b4c6b366ed3c6bd0ff8d39f92e9dae1d3
Author: bsandro <email@bsandro.tech>
Date:   Tue,  1 Oct 2024 08:06:23 +0300

Lightest cleanup in history of cleanups.

Diffstat:
MTODO | 2+-
Mgui/Makefile | 3---
Mgui/main.c | 23+----------------------
Mgui/ui.c | 4++--
4 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/TODO b/TODO @@ -9,7 +9,7 @@ - Fix preview display - pixels with alpha channel are borked - File open/save dialog: display current path on open - Better main window layout -- Split into logical files/headers ++ Split into logical files/headers - Display/update resulting spritesheet dimensions in pixels - Unify path and filename fields (more canonical way) - `-> copy the full path+name into the unified field diff --git a/gui/Makefile b/gui/Makefile @@ -18,6 +18,3 @@ clean: $(NAME): $(OBJ) $(CC) $(OBJ) -o ../$@ $(LDFLAGS) - -run: $(NAME) - ../$(NAME) ../FlanClap.webp 5 diff --git a/gui/main.c b/gui/main.c @@ -2,26 +2,18 @@ * Loosely based on the libwebp example program "anim_dump" */ -// #define _GNU_SOURCE #define _DEFAULT_SOURCE // moved into the compiler command line arguments // #define UI_LINUX + #define UI_IMPLEMENTATION #include <stdio.h> -//#include <stdbool.h> -//#include <stdlib.h> -//#include <libgen.h> -//#include <string.h> -//#include <strings.h> -//#include <assert.h> -//#include <dirent.h> #include <sys/prctl.h> #include "webp/decode.h" #include "webp/encode.h" #include "webp/demux.h" -//#include "luigi.h" #include "animation.h" #include "ui.h" @@ -44,9 +36,6 @@ static void print_webp_version() { printf("webp demuxer version: %d.%d.%d\n", (demux_ver>>16)&0xff, (demux_ver>>8)&0xff, demux_ver&0xff); } -// let it be global variable for now -//static Animation *img = NULL; - #ifdef UI_LINUX int main(int argc, const char **argv) { #else @@ -57,17 +46,7 @@ int WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, i prctl(PR_SET_NAME, "webp-anim-to-spritesheet"); atexit(print_webp_version); - UIInitialise(); - UIWindow *win = MainWindowCreate("emote2ss", WIN_WIDTH, WIN_HEIGHT); - - // do I actually need this? - /*if (argc > 1) { - img = ImageLoad(argv[1]); - assert(img!=NULL); - PreviewUpdate(img, img_disp); - }*/ - return UIMessageLoop(); } diff --git a/gui/ui.c b/gui/ui.c @@ -15,7 +15,7 @@ static Animation *img = NULL; static int FilelistFilter(const struct dirent *f) { if (strncmp(f->d_name, ".", 255)==0) return 0; if (f->d_type==DT_DIR) return 1; - //@todo not very efficient + //@todo not very efficient but dirent doesn't have the length :c size_t len = strlen(f->d_name); // checking for the ".webp" at the very end if (len<6) return 0; @@ -233,7 +233,7 @@ 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 - // @todo this way setting the initial directory is kinda trashcan + // @todo setting the initial directory this way is 100% trashcan char *init_path = (char *)malloc(2*sizeof(char)); init_path[0] = '.'; init_path[1] = '\0';