From d4d6a14694360e0437bfda7416858df5162a5be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 28 Nov 2023 14:48:54 +0100 Subject: [PATCH] add style guide for gui_skinned() --- bind/v4k.lua | 2 +- engine/joint/v4k.h | 24 +++++++++++++++++++++--- engine/split/v4k_gui.c | 4 ++-- engine/split/v4k_gui.h | 20 +++++++++++++++++++- engine/v4k.c | 4 ++-- engine/v4k.h | 20 +++++++++++++++++++- 6 files changed, 64 insertions(+), 10 deletions(-) diff --git a/bind/v4k.lua b/bind/v4k.lua index 7a92c57..76e3cd0 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -3337,7 +3337,7 @@ typedef struct skinned_t { atlas_t atlas; float scale; } skinned_t; - guiskin_t gui_skinned(const char *inifile, float scale); + guiskin_t gui_skinned(const char *asefile, float scale); void* thread( int (*thread_func)(void* user_data), void* user_data ); void thread_destroy( void *thd ); int argc(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index ff3794c..864df6e 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -18146,12 +18146,30 @@ API void gui_popskin(); // default renderers /// skinned +/* The skinning engine depends on an Aseprite asset with slices set up. + While you can specify your own skins for various GUI widgets, some + skin variants are hardcoded and expected to be present in your asset: + + gui_panel(): + - "panel" (overridable) + gui_button(): + - "button" (base overridable) + - "_hover" (ex. "scarybtn_hover") + - "_press" + gui_rect(): + - no defaults, always pass your own skin/slice name + gui_slider(): + - "slider" (overridable) + - "slider_cursor" (partially overridable, ex. "bigslider_cursor") + - "_hover" (ex. "slider_cursor_hover") + - "_press" +*/ typedef struct skinned_t { atlas_t atlas; float scale; } skinned_t; -API guiskin_t gui_skinned(const char *inifile, float scale); +API guiskin_t gui_skinned(const char *asefile, float scale); #line 0 #line 1 "v4k_system.h" @@ -359237,9 +359255,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, vec4 rect, vec4 *d dims->w -= (skinsize.y - coresize.y); } -guiskin_t gui_skinned(const char *inifile, float scale) { +guiskin_t gui_skinned(const char *asefile, float scale) { skinned_t *a = REALLOC(0, sizeof(skinned_t)); - a->atlas = atlas_create(inifile, 0); + a->atlas = atlas_create(asefile, 0); a->scale = scale?scale:1.0f; guiskin_t skin={0}; skin.userdata = a; diff --git a/engine/split/v4k_gui.c b/engine/split/v4k_gui.c index 5d475cd..e2bf9f7 100644 --- a/engine/split/v4k_gui.c +++ b/engine/split/v4k_gui.c @@ -392,9 +392,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, vec4 rect, vec4 *d dims->w -= (skinsize.y - coresize.y); } -guiskin_t gui_skinned(const char *inifile, float scale) { +guiskin_t gui_skinned(const char *asefile, float scale) { skinned_t *a = REALLOC(0, sizeof(skinned_t)); - a->atlas = atlas_create(inifile, 0); + a->atlas = atlas_create(asefile, 0); a->scale = scale?scale:1.0f; guiskin_t skin={0}; skin.userdata = a; diff --git a/engine/split/v4k_gui.h b/engine/split/v4k_gui.h index 7844a56..bed0267 100644 --- a/engine/split/v4k_gui.h +++ b/engine/split/v4k_gui.h @@ -31,9 +31,27 @@ API void gui_popskin(); // default renderers /// skinned +/* The skinning engine depends on an Aseprite asset with slices set up. + While you can specify your own skins for various GUI widgets, some + skin variants are hardcoded and expected to be present in your asset: + + gui_panel(): + - "panel" (overridable) + gui_button(): + - "button" (base overridable) + - "_hover" (ex. "scarybtn_hover") + - "_press" + gui_rect(): + - no defaults, always pass your own skin/slice name + gui_slider(): + - "slider" (overridable) + - "slider_cursor" (partially overridable, ex. "bigslider_cursor") + - "_hover" (ex. "slider_cursor_hover") + - "_press" +*/ typedef struct skinned_t { atlas_t atlas; float scale; } skinned_t; -API guiskin_t gui_skinned(const char *inifile, float scale); +API guiskin_t gui_skinned(const char *asefile, float scale); diff --git a/engine/v4k.c b/engine/v4k.c index 1e545fa..e0cc27d 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -11402,9 +11402,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, vec4 rect, vec4 *d dims->w -= (skinsize.y - coresize.y); } -guiskin_t gui_skinned(const char *inifile, float scale) { +guiskin_t gui_skinned(const char *asefile, float scale) { skinned_t *a = REALLOC(0, sizeof(skinned_t)); - a->atlas = atlas_create(inifile, 0); + a->atlas = atlas_create(asefile, 0); a->scale = scale?scale:1.0f; guiskin_t skin={0}; skin.userdata = a; diff --git a/engine/v4k.h b/engine/v4k.h index 69e67f4..b2edc05 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -4213,12 +4213,30 @@ API void gui_popskin(); // default renderers /// skinned +/* The skinning engine depends on an Aseprite asset with slices set up. + While you can specify your own skins for various GUI widgets, some + skin variants are hardcoded and expected to be present in your asset: + + gui_panel(): + - "panel" (overridable) + gui_button(): + - "button" (base overridable) + - "_hover" (ex. "scarybtn_hover") + - "_press" + gui_rect(): + - no defaults, always pass your own skin/slice name + gui_slider(): + - "slider" (overridable) + - "slider_cursor" (partially overridable, ex. "bigslider_cursor") + - "_hover" (ex. "slider_cursor_hover") + - "_press" +*/ typedef struct skinned_t { atlas_t atlas; float scale; } skinned_t; -API guiskin_t gui_skinned(const char *inifile, float scale); +API guiskin_t gui_skinned(const char *asefile, float scale); #line 0 #line 1 "v4k_system.h"