From 38bf923967bc3a7693b6ba4a6be8609e84592015 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Thu, 28 Nov 2024 15:37:02 +0100 Subject: [PATCH] dynamically update masks to reflect the currently selected colour. --- init.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 69ff41f..427294c 100644 --- a/init.lua +++ b/init.lua @@ -2,7 +2,7 @@ local MP = core.get_modpath("banners") .. "/" dofile(MP .. "smartfs.lua") banners = { - version = 20241128.1507 + version = 20241128.1533 } banners.masks = { @@ -106,7 +106,11 @@ banners.creation_form_func = function(state) state2.current_color = "bg_" .. self.name .. ".png" state2:get("color_indicator"):setImage(state2.current_color) state2.banner.color = state2.current_color - -- todo: update masks or something + -- update masks + for _, mask in ipairs(banners.masks) do + state2:get(mask):setImage("(" .. state2.current_color + .. "^[mask:" .. mask .. ".png^[makealpha:0,0,0)") + end end) x = x + 1 if x > 19 then @@ -119,7 +123,8 @@ banners.creation_form_func = function(state) y = 3 for _, mask in ipairs(banners.masks) do local b = state:button(x, y, 2, 1, mask, "") - b:setImage(mask .. ".png") + b:setImage("(" .. state.current_color + .. "^[mask:" .. mask .. ".png^[makealpha:0,0,0)") b:click(function(self, state2) state2.banner:push_transform({ texture = state2.current_color,