lucaspevidor / InteractiveCanvas

A training project for interacting with an environment through HTML canvas
GNU General Public License v3.0
1 stars 0 forks source link

Implemented background grid rendering #9

Closed lucaspevidor closed 1 year ago

lucaspevidor commented 1 year ago

Description This pull request adds a new feature to the CanvasRenderer class: a DrawGrid method that draws a grid on the canvas.

The DrawGrid method takes a params parameter that specifies the properties of the grid to be drawn. The params parameter is an optional object that conforms to the GridProperties interface. If the params parameter is not specified, the default grid properties are used.

The DrawGrid method draws a grid with the specified properties on the canvas. The grid consists of main lines, secondary lines, and an origin point. The main lines are drawn with the mainColor property, the secondary lines are drawn with the secondaryColor property, and the origin point is drawn with the originColor property. The width of the lines is specified by the lineWidth property, and the size of each grid unit is specified by the unitSize property. The offset of the grid from the canvas origin is specified by the offset property.

The DrawGrid method also optionally draws unit labels along the grid lines. If the showUnits property is set to true, the unit labels are drawn using the unitFont property.

This closes #8