From 49f6e347f01f72e8854308d5a54aaae337489555 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Thu, 11 Apr 2013 13:23:38 -0500 Subject: Lua HUD --- doc/lua_api.txt | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b29c50379..d4d078e27 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1379,7 +1379,20 @@ Player-only: (no-op for other objects) modifies per-player walking speed, jump height, and gravity. Values default to 1 and act as offsets to the physics settings in minetest.conf. nil will keep the current setting. - +- hud_add(id, hud definition) + ^ id is used for later reference + ^ If this id has already been used, it will reset its drawform +- hud_rm(id): remove an id from the lua hud +- hud_change(id, stat, value): change a value of a previously added element + ^ stat/table key: 0/position, 1/name, 2/scale, 3/text, 4/number, + ^ 5/item, 6/dir +- hud_get_next_id(): get the next available id for a hud element +- hud_lock_next_bar(right): add a non-conflicting statbar + ^ if right, will claim spot on right side, rather then left + ^ returns element id on success, false otherwise +- hud_unlock_bar(id): remove a non-conflicting statbar + ^ id is the value returned by calling hud_lock_next_bar() + InvRef: Reference to an inventory methods: - is_empty(listname): return true if list is empty @@ -1802,3 +1815,20 @@ Detached inventory callbacks ^ No return value } +HUD Definition (hud_add) +{ + type = "I", -- One of "I"(image), "S"(statbar), + ^ "T"(text), "i"(inv) + position = {x=0.5, y=0.5}, -- Left corner position + name = "", + scale = {x=2, y=2}, + text = "", + ^ Used as texture name for statbars and images, and as list name + ^ for inv + number = 2, + ^ Used as stat for statbar, and as # of items for inv + item = 3, -- Selected item in inv. 0 -> no item selected + dir = 0, + ^ dir/inv direction: 0/left-right, 1/right-left, + ^ 2/top-bottom, 3/bottom-top +} -- cgit v1.2.3