2.1.3 • Published 10 months ago

screeps-viz v2.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

screeps-viz

sample dashboard

A visualization library for Screeps

Installation

Install via npm:

npm install screeps-viz

Usage

This library is designed around functional programming principles. Until we have better documentation, please consult the source and tests for each widget for its expected parameters, and see src/demo.ts for examples.

Widgets

Most of the widgets will use a pattern like this, passing in a function that will be invoked each tick to get the current data & configuration.

const barWidget = Bar(() => ({
    data: {
        value: Game.time % 20,
        maxValue: 20
    },
    config: {
        label: 'Bar 1',
        style: {
            stroke: 'red',
            fill: 'red',
            lineStyle: 'dashed'
        }
    }
})

Dashboard

The Dashboard itself takes a list of Widgets with position & size information and renders each.

export function loop() {
    Dashboard({ 
        widgets: [{
            x: 1,
            y: 1,
            width: 5,
            height: 10,
            widget: barWidget
        }]
    })
}
2.1.3

10 months ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago