Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@alt1/base

skillbert122deprecated1.0.0-alpha.7TypeScript support: included

All @alt1 libraries have been moved to be sub-imports on the alt1 package in npm. Run 'npm install alt1' and use import 'alt1/base' instead

The base library for Alt1 apps to communicate with the Alt1 API. For intellisense based IDE's it will also add intellisense declarations for the global alt1 object inside the Alt1 browser.

readme

Alt1lib

The base library for Alt1 apps to communicate with the Alt1 API. For intellisense based IDE's it will also add intellisense declarations for the global alt1 object inside the Alt1 browser.

Installation

npm i @alt1/base -s

Usage

import * as a1lib from "@alt1/base";

// Captures a 400x400 rectangle starting at position 100,100 from the top-left of the game area
// imgref now contains a reference to the image (in this case still in Alt1 memory)
var imgref = a1lib.capture(100,100,400,400);

// Retrieve our raw pixel data so we can directly read it
var imagebuffer = imgref.toData();

// Show the image by adding it to the DOM (for debugging)
imagebuffer.show();