History

stats.lua: inherit --osd-shadow-offset

Unlike font and border sizes, the default stats shadow offset is 0 like --osd-shadow-offset, so it can be inherited from it by default to not make users configure it in 2 places. Since 0 and negative numbers are valid offsets, use infinity as the placeholder for unconfigured values.

Guido Cella committed 1 year ago

Commit d84e1b31 parent fc6ce443 files · +13 −8Browse files

Unified · Split

3 files
  1. DOCS/man/stats.rst +2 −2
  2. etc/builtin.conf +0 −2
  3. player/lua/stats.lua +11 −4
DOCS/man/stats.rst+2−2
@@ -175,12 +175,12 @@ Configurable Options · 174 unmodified lines
175 Color of the text border.175 Color of the text border.
176 176
177``shadow_x_offset``177``shadow_x_offset``
178 Default: 0178 Default: same as ``--osd-shadow-offset``
179 179
180 The horizontal distance from the text to position the shadow at.180 The horizontal distance from the text to position the shadow at.
181 181
182``shadow_y_offset``182``shadow_y_offset``
183 Default: 0183 Default: same as ``--osd-shadow-offset``
184 184
185 The vertical distance from the text to position the shadow at.185 The vertical distance from the text to position the shadow at.
186 186
etc/builtin.conf+0−2
@@ -85,8 +85,6 @@ osd-outline-size=0 · 84 unmodified lines
85osd-shadow-offset=485osd-shadow-offset=4
86script-opt=console-border_size=086script-opt=console-border_size=0
87script-opt=stats-border_size=087script-opt=stats-border_size=0
88script-opt=stats-shadow_x_offset=4
89script-opt=stats-shadow_y_offset=4
90 88
91[sub-box]89[sub-box]
92sub-border-style=background-box90sub-border-style=background-box
player/lua/stats.lua+11−4
@@ -57,8 +57,8 @@ local o = { · 56 unmodified lines
57 font_color = "",57 font_color = "",
58 border_size = 1.65,58 border_size = 1.65,
59 border_color = "",59 border_color = "",
60 shadow_x_offset = 0.0,60 shadow_x_offset = math.huge,
61 shadow_y_offset = 0.0,61 shadow_y_offset = math.huge,
62 shadow_color = "",62 shadow_color = "",
63 alpha = "11",63 alpha = "11",
64 vidscale = "auto",64 vidscale = "auto",
@@ -184,8 +184,15 @@ local function text_style() · 119 unmodified lines
184 style = style .. "\\4c&H" .. o.shadow_color .. "&\\4a&H" .. o.alpha .. "&"184 style = style .. "\\4c&H" .. o.shadow_color .. "&\\4a&H" .. o.alpha .. "&"
185 end185 end
186 186
187 return style .. "\\xshad" .. shadow_x_offset ..187 if o.shadow_x_offset < math.huge then
188 "\\yshad" .. shadow_y_offset .. "}"188 style = style .. "\\xshad" .. shadow_x_offset
189 end
190
191 if o.shadow_y_offset < math.huge then
192 style = style .. "\\yshad" .. shadow_y_offset
193 end
194
195 return style
189 end196 end
190end197end
191 198

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t