blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
21 lines • 844 B
JavaScript
/**
* Stores information about a tilesheet that can be used to texture chunks in a {@link ChunkController}.
*/
export default class Tilesheet {
/**
* Creates a {@link Tilesheet} instance and creates a {@link WebGLTexture} from the given image path.
*
* @param gl The webgl context to use when creating the {@link WebGLTexture}
* @param path The path to the tilesheet image
* @param tileSize The size of each individual tile in the tilesheet in px
* @param numOfTiles The number of tiles in the tilesheet
*/
constructor(gl, path, tileSize, numOfTiles) {
// this.texture = loadTexture(gl, path);
this.numOfTiles = numOfTiles;
this.tileSize = tileSize;
this.width = tileSize * 3;
this.height = tileSize * numOfTiles;
}
}
//# sourceMappingURL=tilesheet.js.map