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?
- Sergeant O criticises ‘gutless’ Government over failure to draw line under past
- Council and Show Racism the Red Card try to draw line under row
- SNP minister tries to draw line under trans rights row
- Valverde: Villarreal draw helps Barcelona realise that winning LaLiga Santander won't be easy
- Scott Martin: Accies showed character to draw with Motherwell, and that could be important
- Rock Island Line: The Song That Made Britain Rock
- Line of Duty’s latest shock twist has left viewers stunned — but who could have been behind it?
- EuroMillions draw to create 40 UK millionaires TODAY – here’s how you can win
- Jack Pitt-Brooke: 'Liverpool are showing that the pursuit of glory doesn’t always depend on perfection'
- Tony Ward: 'O'Brien in line for French guillotine after his below-par display in Rome'