diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-10-02 18:01:30 +0200 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-10-02 18:01:30 +0200 |
| commit | 449514853850adca190d7eba679f386c024aa929 (patch) | |
| tree | de57952d2b480e7d1acc0a151d95d6637e4665b6 /code/platform.js | |
| parent | 02841e3c67c92006f9fe08efcda0d15f3d7283c5 (diff) | |
checkpoint
Diffstat (limited to 'code/platform.js')
| -rw-r--r-- | code/platform.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/code/platform.js b/code/platform.js index 30034a4..fda3a49 100644 --- a/code/platform.js +++ b/code/platform.js @@ -79,14 +79,16 @@ async function main() var mouse_clicked = 0; console.log(canvas); - document.onmousemove = function(event) + + document.addEventListener('pointermove', (event) => { + // Update element position here or handle drawing var x_offset = (window.innerWidth - width)/2; var y_offset = (window.innerHeight - height)/2; mouse_x = event.clientX - x_offset; mouse_y = event.clientY - y_offset; - }; + }); document.onmousedown = function(event) { @@ -106,8 +108,8 @@ async function main() prev = timestamp; // TODO(luca): How to get this??? - var update_hz = 144; - instance.exports.RenderGradient(width, height, 1/update_hz, mouse_down, mouse_x, mouse_y); + var update_hz = 30; + instance.exports.RenderGradient(width, height, bytes_per_pixel, 1/update_hz, mouse_down, mouse_x, mouse_y); ctx.putImageData(image, 0, 0); window.requestAnimationFrame(frame); } |
