From 86cbafa06c373a38f48a29c9b2db86cbfe067a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Sun, 11 Feb 2024 15:34:47 +0100 Subject: [PATCH] add support for fwk/v4k plugins --- MAKE.bat | 34 +++++++++++++++++++++++++++------- bind/v4k.lua | 2 +- engine/fwk.h | 2 ++ engine/joint/v4k.h | 4 +++- engine/split/v4k_font.h | 4 +++- engine/v4k.h | 4 +++- 6 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 engine/fwk.h diff --git a/MAKE.bat b/MAKE.bat index 2821378..21c5fae 100644 --- a/MAKE.bat +++ b/MAKE.bat @@ -606,14 +606,34 @@ if "%1"=="addons[" ( shift ) else ( set "addon_names=%1 %addon_names%" - set "addon_includes=-Idepot\deps\%1 %addon_includes%" - if exist "depot\deps\%1\%1.cpp" ( - set "addons=depot\deps\%1\%1.cpp %addons%" - ) else ( - set "addons=depot\deps\%1\%1.c %addons%" + + rem depot folder + if exist "depot\deps\%1" ( + set "addon_includes=-Idepot\deps\%1 %addon_includes%" + if exist "depot\deps\%1\%1.cpp" ( + set "addons=depot\deps\%1\%1.cpp %addons%" + ) else ( + set "addons=depot\deps\%1\%1.c %addons%" + ) + if exist "depot\deps\%1\include" ( + set "addon_includes=-Idepot\deps\%1\include %addon_includes%" + ) ) - if exist "depot\deps\%1\include" ( - set "addon_includes=-Idepot\deps\%1\include %addon_includes%" + if exist "plugins\%1" ( + set "addon_includes=-Iplugins\%1 %addon_includes%" + if exist "plugins\%1\%1.cpp" ( + set "addons=plugins\%1\%1.cpp %addons%" + ) else ( + set "addons=plugins\%1\%1.c %addons%" + ) + if exist "plugins\%1\plugin.cpp" ( + set "addons=plugins\%1\plugin.cpp %addons%" + ) else ( + set "addons=plugins\%1\plugin.c %addons%" + ) + if exist "plugins\%1\include" ( + set "addon_includes=-Iplugins\%1\include %addon_includes%" + ) ) shift && goto parse_addons ) diff --git a/bind/v4k.lua b/bind/v4k.lua index 053d8ee..2f8cc8c 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -681,9 +681,9 @@ typedef struct font_metrics_t { void font_goto(float x, float y); vec2 font_print(const char *text); vec2 font_clip(const char *text, vec4 rect); - const char* font_wrap(const char *text, float max_width); vec2 font_rect(const char *text); font_metrics_t font_metrics(const char *text); + const char* font_wrap(const char *text, float max_width); void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); vec2 font_highlight(const char *text, const void *colors); void ui_font(); diff --git a/engine/fwk.h b/engine/fwk.h new file mode 100644 index 0000000..0c54995 --- /dev/null +++ b/engine/fwk.h @@ -0,0 +1,2 @@ +// compatibility header for fwk plugins +#include "v4k.h" diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index f91e5c3..a0b6741 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -16147,10 +16147,12 @@ API vec2 font_xy(); API void font_goto(float x, float y); API vec2 font_print(const char *text); API vec2 font_clip(const char *text, vec4 rect); -API const char* font_wrap(const char *text, float max_width); API vec2 font_rect(const char *text); API font_metrics_t font_metrics(const char *text); +// utilities +API const char* font_wrap(const char *text, float max_width); + // syntax highlighting API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result. API vec2 font_highlight(const char *text, const void *colors); diff --git a/engine/split/v4k_font.h b/engine/split/v4k_font.h index 30a0c3c..b3c67c1 100644 --- a/engine/split/v4k_font.h +++ b/engine/split/v4k_font.h @@ -90,10 +90,12 @@ API vec2 font_xy(); API void font_goto(float x, float y); API vec2 font_print(const char *text); API vec2 font_clip(const char *text, vec4 rect); -API const char* font_wrap(const char *text, float max_width); API vec2 font_rect(const char *text); API font_metrics_t font_metrics(const char *text); +// utilities +API const char* font_wrap(const char *text, float max_width); + // syntax highlighting API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result. API vec2 font_highlight(const char *text, const void *colors); diff --git a/engine/v4k.h b/engine/v4k.h index ee98424..6392bc2 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -2214,10 +2214,12 @@ API vec2 font_xy(); API void font_goto(float x, float y); API vec2 font_print(const char *text); API vec2 font_clip(const char *text, vec4 rect); -API const char* font_wrap(const char *text, float max_width); API vec2 font_rect(const char *text); API font_metrics_t font_metrics(const char *text); +// utilities +API const char* font_wrap(const char *text, float max_width); + // syntax highlighting API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result. API vec2 font_highlight(const char *text, const void *colors);