From 752b40c4572ff5c85006914a47d7a18848fb9132 Mon Sep 17 00:00:00 2001 From: "Y. Wang" Date: Tue, 29 Oct 2024 18:56:44 +0100 Subject: Rework speed bar again --- advtrains/texture.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'advtrains/texture.lua') diff --git a/advtrains/texture.lua b/advtrains/texture.lua index 34fe83c..07f2436 100644 --- a/advtrains/texture.lua +++ b/advtrains/texture.lua @@ -51,6 +51,10 @@ end function tx.base(str) return tx.raw(tx.escape(str)) end +function tx.lowpart(ratio, file) + return tx.raw(("[lowpart:%d:%s"):format(ratio*100, tx.escape(file))) +end + -- TODO: use [fill when 5.8.0 becomes widely used client-side function tx.fill(w, h, color) return tx"advtrains_hud_bg.png":resize(w, h):colorize(color) @@ -69,6 +73,14 @@ tx_lib.resize = mkmodifier("[resize:%dx%d", {}) tx_lib.transform = mkmodifier("[transform%s", {tx.escape}) tx_lib.makealpha = mkmodifier("[makealpha:%s", {tx.escape}) tx_lib.verticalframe = mkmodifier("[verticalframe:%d:%d]", {}) +tx_lib.overlay_raw = xmkmodifier(tostring) +tx_lib.overlay = function(self, texture) + if type(texture) == "string" then + return self:overlay_raw(tx.escape(texture)) + else + return self:overlay_raw(texture) + end +end -- [combine -- cgit v1.2.3