⚠️ INITIAL DEVELOPMENT ⚠️
Phaser 3 glyph plugin. Inspired by rot.js canvas-based ASCII display. Requires Phaser v3.22+
.
💥 DEMOS
Install the package:
npm install --save @agogpixel/phaser3-glyph-plugin
Extend a scene (TypeScript only) with the plugin mapped to the glyph
property:
import { GlyphPlugin } from '@agogpixel/phaser3-glyph-plugin';
class MyScene extends GlyphPlugin.GlyphScene('glyph', class extends Phaser.Scene {}) {
create() {
const glyphmap = this.add.glyphmap(0, 0, 10, 10);
for (let y = 0; y < glyphmap.heightInCells; ++y) {
for (let x = 0; x < glyphmap.widthInCells; ++x) {
if (!y || !x || y === glyphmap.heightInCells - 1 || x === glyphmap.widthInCells - 1) {
glyphmap.draw(x, y, [['#', '#EEEEEEFE', '#4444']]);
} else {
glyphmap.draw(x, y, [['.', '#FFF']]);
}
}
}
const center = glyphmap.getCenter();
this.cameras.main.centerOn(center.x, center.y);
}
}
Add the plugin & extended scene to the game config:
new Phaser.Game({
// ...
plugins: {
global: [
{
key: 'GlyphPlugin',
plugin: GlyphPlugin,
mapping: 'glyph',
start: true
}
]
},
scene: [MyScene]
// ...
});
Under initial development. Please refer to the API docs & demos for usage examples.
Live development with jest
watch mode:
npm start
Live development with demos:
npm run demos
Lint files:
npm run lint # Report issues.
npm run lint-fix # Fix issues.
Unit test & create coverage report in coverage/
:
npm test
Build consumable .js
, .js.map
, & .d.ts
files to dist/
; prepare for further packaging:
npm run build
Smoke test build:
npm run smoke-test
Create package tarball from dist/
:
npm run create-tarball # Development stream.
npm run create-tarball -- --release # Release stream.
Publish package tarball to registry (some assembly required):
npm run publish-tarball -- NPM
npm run publish-tarball -- GitHub
Tag for stable release with highest version: latest
Development release tag (tracks main
branch): next
Additional distribution tags include:
Distribution | Release | Pre-Release |
---|---|---|
Major versions with highest minor, patch (and possibly pre-release) version. | vX~latest |
vX~next |
Major, minor versions with highest patch (and possibly pre-release) version. | vX.Y~latest |
vX.Y~next |
Major, minor, patch versions - catch all for releases that don't match any of the above. | vX.Y.Z~latest |
vX.Y.Z~next |
Licensed under the MIT License.
Generated using TypeDoc