I need to draw lines and curves on a canvas that is not rendered on the screen but just updates the array of pixels that would otherwise be rendered. I need this to separate my game engine from my renderer.
This has proven rather difficult for my case because I don't use sprites that are loaded, but I draw lines and curves on a canvas.
I have used the p5.js library to accomplish my game, but p5 doesn't let you work without a "setup()" and "draw()" function. I don't want any draw loop or something because that beats the purpose of separating my game engine from my rendering.
I want to use p5 to render after I have all my game logic separate and I can just call nextFrame() or something from my game logic inside draw() in a constant 60 fps.
In p5 it is possible to createGraphics() which works outside of the canvas and doesn't have to render but again, p5 needs a draw() loop to work.
Does anyone know how I can accomplish this?