commit a465a319e38f7c2638e68f76d9a1c1fbbbaabe1b
parent c7da6b18060ea78eb7e8e60618640a33e73efb56
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Wed, 26 Oct 2022 13:06:29 -0500
give draw function time as float
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/main.c b/main.c
@@ -244,7 +244,8 @@ main(int argc, char *argv[])
}
bool done = false;
- unsigned int count = 0;
+ double time = 0;
+ double framecount = 0;
while (!done) {
/* fill with white */
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
@@ -252,7 +253,7 @@ main(int argc, char *argv[])
cairo_fill(cr);
// draw frame
lua_getglobal(L, "drawframe");
- lua_pushnumber(L, count);
+ lua_pushnumber(L, time);
lua_call(L, 1, 1);
done = lua_toboolean(L, -1);
@@ -278,9 +279,10 @@ main(int argc, char *argv[])
}
fflush(stdout);
- frame->pts = count;
+ frame->pts = framecount;
putframe(c, frame, pkt, output);
- count++;
+ time += 0.00390625;
+ framecount += 1;
}
putframe(c, NULL, pkt, output);
diff --git a/smallpond.lua b/smallpond.lua
@@ -716,13 +716,13 @@ end
function drawframe(time)
local toff = 0
print(framewidth - toff, xmax)
- if time > 400 then
+ if time > 4 then
return true
end
for _, staff in ipairs(stafforder) do
local extent = extents[staff]
for i, d in ipairs(staff3[staff]) do
- if d.time*30 < time then
+ if d.time < time then
if d.kind == "glyph" then
draw_glyph(d.glyph, toff + d.x - extent.xmin, d.y - extent.ymin + extent.yoff)
elseif d.kind == "line" then