aboutsummaryrefslogtreecommitdiff
path: root/advtrains/texture.lua
diff options
context:
space:
mode:
authorY. Wang <y5nw@protonmail.com>2024-10-29 18:56:44 +0100
committerY. Wang <y5nw@protonmail.com>2024-10-29 18:56:44 +0100
commit752b40c4572ff5c85006914a47d7a18848fb9132 (patch)
tree6142c21f159a0cb95c798c07f9d650bb0091f464 /advtrains/texture.lua
parentab26f1d56ae1a4ef70ddda41f583dce5b071f32c (diff)
downloadadvtrains-752b40c4572ff5c85006914a47d7a18848fb9132.tar.gz
advtrains-752b40c4572ff5c85006914a47d7a18848fb9132.tar.bz2
advtrains-752b40c4572ff5c85006914a47d7a18848fb9132.zip
Rework speed bar again
Diffstat (limited to 'advtrains/texture.lua')
-rw-r--r--advtrains/texture.lua12
1 files changed, 12 insertions, 0 deletions
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