mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 22:20:44 +00:00
commit
9aa08a4a4f
4 changed files with 17 additions and 3 deletions
|
@ -35,7 +35,7 @@ var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xS
|
|||
{
|
||||
var data = ParseXMLBitmapFont(xml, frame, xSpacing, ySpacing, texture);
|
||||
|
||||
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
|
||||
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey, fromAtlas: true });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMat
|
|||
|
||||
camera.addToRenderList(src);
|
||||
|
||||
var textureFrame = src.frame;
|
||||
var textureFrame = src.fromAtlas
|
||||
? src.frame
|
||||
: src.texture.frames['__BASE'];
|
||||
|
||||
var displayCallback = src.displayCallback;
|
||||
var callbackData = src.callbackData;
|
||||
|
|
|
@ -264,6 +264,15 @@ var BitmapText = new Class({
|
|||
*/
|
||||
this.dropShadowAlpha = 0.5;
|
||||
|
||||
/**
|
||||
* Indicates whether the font texture is from an atlas or not.
|
||||
*
|
||||
* @name Phaser.GameObjects.BitmapText#fromAtlas
|
||||
* @type {boolean}
|
||||
* @since 3.53.2
|
||||
*/
|
||||
this.fromAtlas = entry.fromAtlas === true;
|
||||
|
||||
this.setTexture(entry.texture, entry.frame);
|
||||
this.setPosition(x, y);
|
||||
this.setOrigin(0, 0);
|
||||
|
@ -758,6 +767,7 @@ var BitmapText = new Class({
|
|||
this.fontData = entry.data;
|
||||
this._fontSize = size;
|
||||
this._align = align;
|
||||
this.fromAtlas = entry.fromAtlas === true;
|
||||
|
||||
this.setTexture(entry.texture, entry.frame);
|
||||
|
||||
|
|
|
@ -34,7 +34,9 @@ var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix)
|
|||
|
||||
camera.addToRenderList(src);
|
||||
|
||||
var textureFrame = src.texture.frames['__BASE'];
|
||||
var textureFrame = src.fromAtlas
|
||||
? src.frame
|
||||
: src.texture.frames['__BASE'];
|
||||
|
||||
var chars = src.fontData.chars;
|
||||
var lineHeight = src.fontData.lineHeight;
|
||||
|
|
Loading…
Reference in a new issue