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
175175 Color of the text border.
176176
177177 ``shadow_x_offset``
178− Default: 0
178+ Default: same as ``--osd-shadow-offset``
179179
180180 The horizontal distance from the text to position the shadow at.
181181
182182 ``shadow_y_offset``
183− Default: 0
183+ Default: same as ``--osd-shadow-offset``
184184
185185 The vertical distance from the text to position the shadow at.
186186
etc/builtin.conf+0−2
@@ -85,8 +85,6 @@ osd-outline-size=0 · 84 unmodified lines
8585 osd-shadow-offset=4
8686 script-opt=console-border_size=0
8787 script-opt=stats-border_size=0
88−script-opt=stats-shadow_x_offset=4
89−script-opt=stats-shadow_y_offset=4
9088
9189 [sub-box]
9290 sub-border-style=background-box
player/lua/stats.lua+11−4
@@ -57,8 +57,8 @@ local o = { · 56 unmodified lines
5757 font_color = "",
5858 border_size = 1.65,
5959 border_color = "",
60− shadow_x_offset = 0.0,
61− shadow_y_offset = 0.0,
60+ shadow_x_offset = math.huge,
61+ shadow_y_offset = math.huge,
6262 shadow_color = "",
6363 alpha = "11",
6464 vidscale = "auto",
@@ -184,8 +184,15 @@ local function text_style() · 119 unmodified lines
184184 style = style .. "\\4c&H" .. o.shadow_color .. "&\\4a&H" .. o.alpha .. "&"
185185 end
186186
187− return style .. "\\xshad" .. shadow_x_offset ..
188− "\\yshad" .. shadow_y_offset .. "}"
187+ if o.shadow_x_offset < math.huge then
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
189196 end
190197 end
191198

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