@tamb/gamegrid
    Preparing search index...

    @tamb/gamegrid

    GameGrid API reference

    @tamb/gamegrid — a TypeScript library for 2D grid-based web games and interactive matrices.

    Also see: site home · interactive demo · GitHub README

    Browse the full API on the exports index:

    Section Symbols
    Grid runtime GameGrid (default export)
    Grid contract IGameGrid
    Configuration IConfig, IOptions, MiddlewareFn
    State IState, StatePatch, IDefaultState, INITIAL_STATE
    Data model ICell, ICellContext
    Events gridEventsEnum, gameGridEventsEnum, IGameGridEventDetail, GameGridDOMEvent
    Zoom IZoomBounds, IZoomOptions, IRegionTile, ZoomQuadrant
    References IRefsObject, IRow
    Cells cellTypeEnum
    Movement directionEnum
    Inputs keycodeEnum
    Presentation classesEnum, directionClassEnum

    Movement and state use [x, y]: column (x), then row (y). The backing matrix is matrix[row][col]matrix[y][x].

    import GameGrid, { gridEventsEnum, type GameGridDOMEvent } from "@tamb/gamegrid";

    const grid = new GameGrid(
    {
    matrix: myMatrix,
    state: { activeCoords: [0, 0] },
    options: { wasdControls: true },
    },
    document.querySelector("#root")!,
    );

    grid.moveDown();
    window.addEventListener(gridEventsEnum.MOVE_LAND, (e: Event) => {
    const ce = e as GameGridDOMEvent;
    console.log(ce.detail.gameGridInstance.getState());
    });

    Omit the container argument for headless use, then call render(element) when you need DOM.