Skip to content

The tool allows to inline sprites (icons) into text. Can be used with PIXI as well as Phaser

Notifications You must be signed in to change notification settings

RJA7/text-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Icons

The tool allows to inline sprites into PIXI text objects.

Setup

import * as textIcons from 'text-icons';

textIcons.extend(PIXI);

Usage

const textObject = new PIXI.Text('PIXI @coin@ Phaser\nText Icons @coin@ !');

textObject.icons = {
  '@coin@': new PIXI.Sprite(PIXI.Texture.from('coin.png')),
}

Notes

The keys for icons object cannot contain some special symbols, which require escapes in regex.

Do not use $, . and others.

Use letters, @ and _.

About

The tool allows to inline sprites (icons) into text. Can be used with PIXI as well as Phaser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published