Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lovely/ui_elements.toml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ end
match_indent = true

# Apply shaders on text elements
# Also draw text outline
# UIElement:draw_self
[[patches]]
[patches.pattern]
Expand All @@ -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,
Expand Down
38 changes: 37 additions & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {}
Expand Down