@tamb/gamegrid
    Preparing search index...

    Class GameGrid

    Stateful 2‑D lattice with collision rules and optional HTMLElement projection.

    const grid = new GameGrid({ matrix, options: { wasdControls: true } }, document.querySelector('#stage')!);
    
    const grid = new GameGrid({ matrix });
    grid.moveRight(); // mutates internal state without touching the DOM

    Implements

    Index

    Constructors

    Properties

    options: IOptions

    Runtime toggles: input, collisions, middleware, callbacks, styling. Merged from ctor defaults and GameGrid.setOptions.

    After GameGrid.render, hydrated rows/cells and container. Headless grids mirror cells onto the logical matrix until mount.

    Methods

    • Detach listeners when rendered and clear injected structure; resets rendered in state.

      Returns void

      Idempotent-friendly: always dispatches gridEventsEnum.DESTROYED whether or not DOM was present.

    • Logical cell from GameGrid.getMatrix: matrix[coords[1]][coords[0]] — raw matrix lookup (bounds unchecked).

      Parameters

      • coords: number[] | readonly [number, number]

        [x, y].

      Returns ICell

    • Mount markup into container, wire keyboard/pointer handlers, activate initial cell.

      Parameters

      • container: HTMLElement

      Returns void

      Clears/rebuilds refs for this mount. Prefer GameGrid.refresh after the first paint when rebuilding from the same host. Dispatches gridEventsEnum.RENDERED once the container is patched and listeners attach.