Renderer module - Lucas-Code27/Canvas-plus-plus GitHub Wiki
How to set up
[!IMPORTANT] The Renderer will go through some heavy changes as the engine becomes more advanced and requires more robust systems so expect changes in the future
First import the module
import * as renderer from "./canvas++/modules/rendering.js"
Then init the renderer
// The ID of your canvas in your html is used as the argument
renderer.initRenderer("mainCanvas")
Now you're ready to use the renderer functions!
Functions
[!NOTE] the Color arg is a string with the hex code or html color you want to use
- clear(color) - Will draw a fullscreen rectangle (use this to clear the screen every frame)
- fillColor(color) - sets the color to fill what ever you choose to draw next
- setStroke(width,color) - sets the params for the outlines using stroke
- drawRect(x,y,width,height,fill?,outline?) - draws a rectangle at the position and size specified
- drawText(font,text,x,y) - Draws text using the font you chose at the position specified