avg-core-ts
Version:
Develop Adventure Game (or ADV, Visual Novel, Galgame, etc.) on your own!
31 lines (26 loc) • 778 B
JavaScript
/**
* @file Text sprite class
* @author MicroMatrix <yangpan.1985@bytedance.com>
* @copyright 2012-2020 bytedance
* @link git@code.byted.org:yangpan.1985/avg.git
*/
const PIXI = require('pixi.js');
/**
* Class representing a TextSprite. <br>
* default font style is `normal 24px sans-serif`
* @extends PIXI.Text
* @param {string} text The string that you would like the text to display
* @param {object} style The style parameters, see http://pixijs.download/v4.2.3/docs/PIXI.TextStyle.html
*/
class TextSprite extends PIXI.Text {
constructor(text = '', style = {}) {
super(text, {
fontFamily: 'sans-serif',
fontSize: 24,
fill: 0xffffff,
...style,
});
this.zorder = 0;
}
}
module.exports = TextSprite;