~rabbits/public-inbox

Uxn5: fix uxn screen evaluating too fast on high refresh rate devices v1 PROPOSED

Nojus Raskevicius: 1
 Uxn5: fix uxn screen evaluating too fast on high refresh rate devices

 1 files changed, 12 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rabbits/public-inbox/patches/48662/mbox | git am -3
Learn more about email & git

[PATCH] Uxn5: fix uxn screen evaluating too fast on high refresh rate devices Export this patch

---
 src/app.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/app.js b/src/app.js
index 216bff7..d741749 100644
--- a/src/app.js
+++ b/src/app.js
@@ -15,6 +15,9 @@ const emulator = new Emu()

const share = new ShareView(document.getElementById("share"));

var frametime = 0;
const TARGET_FPS = 60;

emulator.init().then(() => {
  emulator.console.write_el = document.getElementById("console_std")
  emulator.console.error_el = document.getElementById("console_err")
@@ -42,7 +45,15 @@ emulator.init().then(() => {

  // Animation callback
  function step() {
    emulator.screen_callback();

    var current = performance.now();
    var delta = current - frametime;

    if (delta > 1000 / TARGET_FPS) {
      emulator.screen_callback();
      frametime = current;
    }

    window.requestAnimationFrame(step)
  }

-- 
2.42.0