commit 5c945a678986c50d11ee05627c0af1fd617cfae5
parent bdd04b33076911856b3df7d330df882a98471ebe
Author: bsandro <email@bsandro.tech>
Date: Tue, 1 Oct 2024 23:54:17 +0300
Added display pixel dimensions of generated spritesheet, updated README slightly
Diffstat:
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/README b/README
@@ -9,6 +9,8 @@ There is a GUI version with a preview of the output sprite and a command-line ut
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
+GUI Usage: should be self-explanatory, it doesn't support command-line arguments as of yet.
+
Dependencies:
Libraries: libwebp and libwebpdemux.
Bundled GUI toolkit: luigi - https://github.com/nakst/luigi
@@ -16,7 +18,9 @@ Bundled GUI toolkit: luigi - https://github.com/nakst/luigi
Building:
Only libraries above, C99 compiler, standard pkg-config and GNU Makefile are needed.
I've tested builds for GNU/Linux, OpenBSD and macOS.
-To build on Windows platform change '-DUI_LINUX' to '-DUI_WINDOWS' in gui/Makefile.
+
+Windows builds are still WIP, it was sufficient to change '-DUI_LINUX' to '-DUI_WINDOWS' in gui/Makefile before but not after many changes in gui version.
To build GUI tool run `make gui`.
-To build CLI tool run `make cli`
+To build CLI tool run `make cli`.
+Or just run `make` to build everything.
diff --git a/TODO b/TODO
@@ -10,9 +10,9 @@
- File open/save dialog: display current path on open
- Better main window layout
+ Split into logical files/headers
-- Display/update resulting spritesheet dimensions in pixels
++ Display/update resulting spritesheet dimensions in pixels
- Unify path and filename fields (more canonical way)
- `-> copy the full path+name into the unified field
- M$ Windows build
- Use system open/save dialog on Windows?
-
+- Remember last open directory
diff --git a/gui/ui.c b/gui/ui.c
@@ -37,10 +37,10 @@ UIWindow * MainWindowCreate(const char *wname, int w, int h) {
UIWindow *win = UIWindowCreate(0, 0, wname, w, h);
win->e.messageUser = WinMainEvent;
UIPanel *panelv = UIPanelCreate(&win->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING);
- lbl_header = UILabelCreate(&panelv->e, 0, "filename", -1);
+ lbl_header = UILabelCreate(&panelv->e, 0, "webp 2 spritesheet converter", -1);
UIPanel *panelh = UIPanelCreate(&panelv->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING|UI_PANEL_HORIZONTAL);
- UILabel *label = UILabelCreate(&panelh->e, 0, "webp to spritesheet converter", -1);
+ UILabel *label = UILabelCreate(&panelh->e, 0, "Size: 0x0px", -1);
UISlider *slider = UISliderCreate(&panelh->e, 0);
UIButton *btnopen = UIButtonCreate(&panelh->e, 0, "Open", -1);
btnopen->e.messageUser = ButtonOpenEvent;
@@ -310,7 +310,7 @@ void PreviewUpdate(Animation *img, UIImageDisplay *img_disp) {
UILabel *label = (UILabel *)img_disp->e.cp;
char label_text[256] = {0};
- snprintf(&label_text, 255, "Width: %3d tiles", cols);
+ snprintf(&label_text, 255, "Size: %4dx%4dpx", ss.width, ss.height);
UILabelSetContent(label, label_text, -1);
UIElementRefresh(label->e.parent);
}