emote2ss

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

commit 0960303193e14f0e7492df1819da4680b6044f0b
parent ce322176ffa44de3b737c9ba29206203b4158b62
Author: bsandro <[email protected]>
Date:   Sat, 26 Aug 2023 11:32:05 +0300

- Scroll bugfix: no longer crashing on value change if no image is loaded
- Setting OS specific flag is now done via command line argument

Diffstat:
MTODO | 2++
Mgui/Makefile | 2+-
Mgui/main.c | 6+++++-
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/TODO b/TODO @@ -6,3 +6,5 @@ - i18n - Status bar with service/info messages - Fix preview display - pixels with alpha channel are borked +- Better file open/save dialog +- Split into files/headers diff --git a/gui/Makefile b/gui/Makefile @@ -3,7 +3,7 @@ SRC:=$(wildcard *.c) DEPS:=$(wildcard ../include/*.h) OBJ:=$(SRC:.c=.o) LIBS:=libwebp libwebpdemux x11 -CFLAGS=-O0 -g -std=c99 -ffast-math -I. -I../include/ ${shell pkg-config --cflags $(LIBS)} +CFLAGS=-O0 -g -std=c99 -DUI_LINUX -ffast-math -I. -I../include/ ${shell pkg-config --cflags $(LIBS)} LDFLAGS=-lc -lm ${shell pkg-config --libs $(LIBS)} all: $(NAME) diff --git a/gui/main.c b/gui/main.c @@ -3,7 +3,9 @@ */ #define _GNU_SOURCE -#define UI_LINUX + +// moved into the compiler command line arguments +// #define UI_LINUX #define UI_IMPLEMENTATION #include <stdio.h> @@ -419,6 +421,8 @@ void PreviewUpdate(Animation *img, UIImageDisplay *img_disp) { int SliderEvent(UIElement *element, UIMessage msg, int di, void *dp) { if (msg == UI_MSG_VALUE_CHANGED) { + if (img == NULL) return 1; + float slider_pos = ((UISlider *)element)->position; float step = 1.0f / (float)img->frame_count; int new_cols = (int)(slider_pos / step);