twn_rendering.c: rename font_path parameter to font

This commit is contained in:
veclav talica 2024-10-07 12:32:06 +03:00
parent b9f2de1e28
commit cfdc1f5f28
2 changed files with 8 additions and 8 deletions

View File

@ -193,7 +193,7 @@ static int b_rectangle(lua_State *L) {
* position [table] * position [table]
* height_px [number], optional, defaults to 22 * height_px [number], optional, defaults to 22
* color [table], optional, defaults to black * color [table], optional, defaults to black
* font_path [string] * font [string]
*/ */
static int b_text(lua_State *L) { static int b_text(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE); luaL_checktype(L, 1, LUA_TTABLE);
@ -222,12 +222,12 @@ static int b_text(lua_State *L) {
if (lua_istable(L, -1)) if (lua_istable(L, -1))
color = table_to_color(L, -1); color = table_to_color(L, -1);
lua_getfield(L, 1, "font_path"); lua_getfield(L, 1, "font");
const char *font_path = lua_tostring(L, -1); const char *font = lua_tostring(L, -1);
if (font_path == NULL) if (font == NULL)
luaL_error(L, "bad field 'font_path' in 'data' (string expected, got %s)", luaL_typename(L, -1)); luaL_error(L, "bad field 'font' in 'data' (string expected, got %s)", luaL_typename(L, -1));
push_text(string, (Vec2) { x, y }, height_px, color, font_path); push_text(string, (Vec2) { x, y }, height_px, color, font);
return 0; return 0;
} }

View File

@ -33,8 +33,8 @@ TWN_API void push_rectangle(Rect rect, Color color);
/* pushes a filled circle onto the circle render queue */ /* pushes a filled circle onto the circle render queue */
TWN_API void push_circle(Vec2 position, float radius, Color color); TWN_API void push_circle(Vec2 position, float radius, Color color);
TWN_API void push_text(char *string, Vec2 position, int height_px, Color color, const char *font_path); TWN_API void push_text(char *string, Vec2 position, int height_px, Color color, const char *font);
TWN_API int text_get_width(char *string, int height_px, const char *font_path); TWN_API int text_get_width(char *string, int height_px, const char *font);
TWN_API void push_9slice(char *texture_path, int texture_w, int texture_h, int border_thickness, Rect rect, Color color); TWN_API void push_9slice(char *texture_path, int texture_w, int texture_h, int border_thickness, Rect rect, Color color);