emote2ss

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

commit 8d5afbfa1dc4384bf263e4270285a7f651fc714b
parent 7c608da9bfe2af6e0501294c79ffa759dd499f4a
Author: bsandro <email@bsandro.tech>
Date:   Sat, 30 Aug 2025 13:53:55 +0300

Added (non-working for now) +/- buttons, remade window layout

Diffstat:
Mgui/ui.c | 23++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/gui/ui.c b/gui/ui.c @@ -40,18 +40,23 @@ 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, "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, "Size: 0x0px", -1); - UISlider *slider = UISliderCreate(&panelh->e, 0); - UIButton *btnopen = UIButtonCreate(&panelh->e, 0, "Open", -1); + // label with filename, buttons open/save/exit + UIPanel *panelh_top = UIPanelCreate(&panelv->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING|UI_PANEL_HORIZONTAL|UI_ELEMENT_H_FILL); + UIButton *btnopen = UIButtonCreate(&panelh_top->e, 0, "Open", -1); btnopen->e.messageUser = ButtonOpenEvent; - UIButton *btnsave = UIButtonCreate(&panelh->e, 0, "Save", -1); + UIButton *btnsave = UIButtonCreate(&panelh_top->e, 0, "Save", -1); btnsave->e.messageUser = ButtonSaveEvent; btnsave->e.cp = win; - UIButton *btn_exit = UIButtonCreate(&panelh->e, 0, "Exit", -1); + UIButton *btn_exit = UIButtonCreate(&panelh_top->e, 0, "Exit", -1); btn_exit->e.messageUser = ButtonCloseEvent; + lbl_header = UILabelCreate(&panelh_top->e, 0, "webp 2 spritesheet converter", -1); + + // scroll with dimensions label + UIPanel *panelh_bottom = UIPanelCreate(&panelv->e, UI_PANEL_GRAY|UI_PANEL_SMALL_SPACING|UI_PANEL_HORIZONTAL|UI_PANEL_EXPAND|UI_ELEMENT_H_FILL); + UILabel *label = UILabelCreate(&panelh_bottom->e, 0, "Size: 0x0px", -1); + UIButton *btnminus = UIButtonCreate(&panelh_bottom->e, 0, "-", -1); + UIButton *btnplus = UIButtonCreate(&panelh_bottom->e, 0, "+", -1); + UISlider *slider = UISliderCreate(&panelh_bottom->e, UI_ELEMENT_H_FILL); img_disp = UIImageDisplayCreate(&panelv->e, UI_ELEMENT_V_FILL|UI_ELEMENT_H_FILL|UI_IMAGE_DISPLAY_INTERACTIVE|_UI_IMAGE_DISPLAY_ZOOM_FIT, NULL, 0, 0, 0); img_disp->e.cp = label; @@ -117,8 +122,8 @@ int ButtonDialogOpenEvent(UIElement *element, UIMessage msg, int di, void *dp) { } img = ImageLoad(filepath); assert(img!=NULL); - PreviewUpdate(img, img_disp); UILabelSetContent(lbl_header, img->path, -1); + PreviewUpdate(img, img_disp); } return 0; }