Browse code

Move `remove` after `append` to reduce flickering

Robert Cranston authored on 28/12/2024 21:27:17
Showing 1 changed files

... ...
@@ -50,17 +50,18 @@ end
50 50
 
51 51
 local function append(angle)
52 52
     state.angle = angle % 360
53
-    remove()
54
-    state.shader = os.tmpname()
55
-    mp.msg.debug("Writing", state.shader)
56
-    local file = io.open(state.shader, "w")
53
+    local shader = os.tmpname()
54
+    mp.msg.debug("Writing", shader)
55
+    local file = io.open(shader, "w")
57 56
     file:write(table.concat({
58 57
         SHADER_META,
59 58
         shader_define(),
60 59
         SHADER_HOOK,
61 60
     }, "\n"))
62 61
     file:close()
63
-    mp.commandv("change-list", "glsl-shaders", "append", state.shader)
62
+    mp.commandv("change-list", "glsl-shaders", "append", shader)
63
+    remove()
64
+    state.shader = shader
64 65
 end
65 66
 
66 67
 --- Events