summaryrefslogtreecommitdiff
path: root/engine/structures/Grid.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-21 14:50:09 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-21 14:50:09 -0600
commitb786fe1e723b7cf905cdd7e525375dfe96241a21 (patch)
tree7f7b9da960c62b8e4667a173913f950ea0ec0758 /engine/structures/Grid.ts
parent8fce5a5f2530496e1390763364c01392a1a63640 (diff)
downloadjumpstorm-b786fe1e723b7cf905cdd7e525375dfe96241a21.tar.gz
jumpstorm-b786fe1e723b7cf905cdd7e525375dfe96241a21.zip
add default arguments to grid; add grid to server gl
Diffstat (limited to 'engine/structures/Grid.ts')
-rw-r--r--engine/structures/Grid.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/engine/structures/Grid.ts b/engine/structures/Grid.ts
index 836aaf4..6e8c0cb 100644
--- a/engine/structures/Grid.ts
+++ b/engine/structures/Grid.ts
@@ -1,5 +1,6 @@
import type { Coord2D, Dimension2D } from "../interfaces";
import type { BoxedEntry, RefreshingCollisionFinderBehavior } from ".";
+import { Miscellaneous } from "../config/constants";
export class Grid implements RefreshingCollisionFinderBehavior {
private cellEntities: Map<number, string[]>;
@@ -9,8 +10,14 @@ export class Grid implements RefreshingCollisionFinderBehavior {
private topLeft: Coord2D;
constructor(
- gridDimension: Dimension2D,
- cellDimension: Dimension2D,
+ gridDimension: Dimension2D = {
+ width: Miscellaneous.WIDTH,
+ height: Miscellaneous.HEIGHT,
+ },
+ cellDimension: Dimension2D = {
+ width: Miscellaneous.DEFAULT_GRID_WIDTH,
+ height: Miscellaneous.DEFAULT_GRID_HEIGHT,
+ },
topLeft = { x: 0, y: 0 }
) {
this.gridDimension = gridDimension;