From 599a0896f57718f907f48684e10040b5a1d5ffd0 Mon Sep 17 00:00:00 2001
From: Vito Caputo <vcaputo@pengaru.com>
Date: Thu, 9 Jun 2022 22:47:07 -0700
Subject: modules/plato: derive movement from delta ticks

This way if a given context gets rendered repeatedly for the same
tick, no movement occurs, until ticks changes.
---
 src/modules/plato/plato.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/modules/plato')

diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c
index ffa7e68..3aa89fa 100644
--- a/src/modules/plato/plato.c
+++ b/src/modules/plato/plato.c
@@ -626,7 +626,8 @@ static void plato_render_fragment(til_module_context_t *context, unsigned ticks,
 {
 	plato_context_t	*ctxt = (plato_context_t *)context;
 
-	ctxt->r += .015f;
+	ctxt->r += (float)(ticks - context->ticks) * .001f;
+	context->ticks = ticks;
 	til_fb_fragment_clear(fragment);
 
 	for (int i = 0; i < sizeof(polyhedra) / sizeof(*polyhedra); i++) {
-- 
cgit v1.2.3