diff --git a/lovely/ui_elements.toml b/lovely/ui_elements.toml index 53a9089e3..0aa196db0 100644 --- a/lovely/ui_elements.toml +++ b/lovely/ui_elements.toml @@ -276,6 +276,7 @@ end match_indent = true # Apply shaders on text elements +# Also draw text outline # UIElement:draw_self [[patches]] [patches.pattern] @@ -294,6 +295,9 @@ payload = """ local text_shaders = SMODS.resolve_ui_shaders(self, self.states.visible and self.config.shader, nil) for _, v in ipairs(text_shaders) do if v then self:set_text_shader(v.shader, v.send, false) end + if self.config.text_outline then + self:draw_text_outline(button_active) + end love.graphics.draw( self.config.text_drawable, self.config.lang.font.TEXT_OFFSET.x*(self.config.scale)*self.config.lang.font.FONTSCALE/G.TILESIZE, diff --git a/src/utils.lua b/src/utils.lua index b373d2d3c..c8b3c6395 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2691,7 +2691,8 @@ function SMODS.localize_box(lines, args) underline = part.control.u and loc_colour(part.control.u), strikethrough = part.control.st and loc_colour(part.control.st), font = SMODS.Fonts[part.control.f] or G.FONTS[tonumber(part.control.f)], - scale_mod = part.control.s and tonumber(part.control.s) or args.scale or 1 + scale_mod = part.control.s and tonumber(part.control.s) or args.scale or 1, + text_outline = part.control.O and loc_colour(part.control.O), } local desc_scale = (thunk.font or G.LANG.font).DESCSCALE if G.F_MOBILE_UI then desc_scale = desc_scale*1.5 end @@ -2725,6 +2726,7 @@ function SMODS.localize_box(lines, args) button = part.control.button, strikethrough = part.control.st and loc_colour(part.control.st), underline = part.control.u and loc_colour(part.control.u), + text_outline = part.control.O and loc_colour(part.control.O), scale = (0.55 - 0.004*#(final_name_assembled_string or assembled_string))*thunk.scale_mod*(args.fixed_scale or 1) }) }} @@ -2763,6 +2765,7 @@ function SMODS.localize_box(lines, args) font = thunk.font, underline = thunk.underline, strikethrough = thunk.strikethrough, + text_outline = thunk.text_outline, scale = 0.32*thunk.scale_mod*desc_scale}}, }} else @@ -2783,6 +2786,7 @@ function SMODS.localize_box(lines, args) font = thunk.font, underline = thunk.underline, strikethrough = thunk.strikethrough, + text_outline = thunk.text_outline, scale = 0.32*thunk.scale_mod*desc_scale }} end @@ -4157,6 +4161,38 @@ function UIElement:set_text_shader(shader, send, shadow) }) end +function UIElement:draw_text_outline(button_active) + if not button_active then + return + end + love.graphics.setColor(self.config.text_outline) + for x = -1, 1 do + for y = -1, 1 do + if x ~= 0 or y ~= 0 then + love.graphics.draw( + self.config.text_drawable, + ((self.config.font or self.config.lang.font).TEXT_OFFSET.x + x * 20) + * self.config.scale + * (self.config.font or self.config.lang.font).FONTSCALE + / G.TILESIZE, + ((self.config.font or self.config.lang.font).TEXT_OFFSET.y + y * 20) + * self.config.scale + * (self.config.font or self.config.lang.font).FONTSCALE + / G.TILESIZE, + 0, + self.config.scale + * (self.config.font or self.config.lang.font).squish + * (self.config.font or self.config.lang.font).FONTSCALE + / G.TILESIZE, + self.config.scale * (self.config.font or self.config.lang.font).FONTSCALE / G.TILESIZE + ) + end + end + end + love.graphics.setColor(self.config.colour) +end + + -- function to modify score: normally accepts add and mult argument and additionally card argument SMODS.mod_score = function(score_mod) score_mod = score_mod or {}