Indeed, working with that framebuffer isn't very easy, but that's part of the point for me. Having to deal with these weird details is fun.
My first attempt at this did involve an ArrayBuffer Graphics object. I still don't have a proper grasp of the Bangle.js code, but I was under the impression that it doesn't do a quick blit from that to the framebuffer. There's also the RAM cost.
Writing the code that finds the buffer in RAM was fun too, but of course it would be better to have a safe API that takes DMA into account. That said, I don't notice any tearing. Before writing to the framebuffer I call 'g.drawRect(-1, -1, 0, 177)' so that all of the rows get marked as dirty. I imagine this blocks until DMA is done?
I haven't checked the speed yet, nor am I sure of the best way to do so. What is the highest resolution timer I can use? Date.now()? I noticed that adding more ships makes the framerate drop, not because of the graphics code, but because of the javascript that controls the movement. Adding the equivalent amount of triangles as stars (controlled by C) has a much lower impact.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Indeed, working with that framebuffer isn't very easy, but that's part of the point for me. Having to deal with these weird details is fun.
My first attempt at this did involve an ArrayBuffer Graphics object. I still don't have a proper grasp of the Bangle.js code, but I was under the impression that it doesn't do a quick blit from that to the framebuffer. There's also the RAM cost.
Writing the code that finds the buffer in RAM was fun too, but of course it would be better to have a safe API that takes DMA into account. That said, I don't notice any tearing. Before writing to the framebuffer I call 'g.drawRect(-1, -1, 0, 177)' so that all of the rows get marked as dirty. I imagine this blocks until DMA is done?
I haven't checked the speed yet, nor am I sure of the best way to do so. What is the highest resolution timer I can use?
Date.now()
? I noticed that adding more ships makes the framerate drop, not because of the graphics code, but because of the javascript that controls the movement. Adding the equivalent amount of triangles as stars (controlled by C) has a much lower impact.