diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
commit | 51de1d8436100f725f3576aefa24a2bd2057bc28 (patch) | |
tree | c6d1d5264b6d40a8d7ca34129f36b7d61e188af3 /TOOLS/lua/osd-test.lua | |
parent | Initial commit. (diff) | |
download | mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.tar.xz mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.zip |
Adding upstream version 0.37.0.upstream/0.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'TOOLS/lua/osd-test.lua')
-rw-r--r-- | TOOLS/lua/osd-test.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/TOOLS/lua/osd-test.lua b/TOOLS/lua/osd-test.lua new file mode 100644 index 0000000..1b17819 --- /dev/null +++ b/TOOLS/lua/osd-test.lua @@ -0,0 +1,35 @@ +local assdraw = require 'mp.assdraw' +local utils = require 'mp.utils' + +things = {} +for i = 1, 2 do + things[i] = { + osd1 = mp.create_osd_overlay("ass-events"), + osd2 = mp.create_osd_overlay("ass-events") + } +end +things[1].text = "{\\an5}hello\\Nworld" +things[2].text = "{\\pos(400, 200)}something something" + +mp.add_periodic_timer(2, function() + for i, thing in ipairs(things) do + thing.osd1.data = thing.text + thing.osd1.compute_bounds = true + --thing.osd1.hidden = true + local res = thing.osd1:update() + print("res " .. i .. ": " .. utils.to_string(res)) + + thing.osd2.hidden = true + if res ~= nil and res.x0 ~= nil then + local draw = assdraw.ass_new() + draw:append("{\\alpha&H80}") + draw:draw_start() + draw:pos(0, 0) + draw:rect_cw(res.x0, res.y0, res.x1, res.y1) + draw:draw_stop() + thing.osd2.hidden = false + thing.osd2.data = draw.text + end + thing.osd2:update() + end +end) |