mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Text.setText has a new optional argument immediate
which will re-create the texture immediately upon call, rather than wait for the next render pass to do so (thanks @Scraft #2594)
This commit is contained in:
parent
b24de1e561
commit
a0c771d47e
3 changed files with 28 additions and 11 deletions
|
@ -330,6 +330,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
|||
* The TilemapParser will now add more data when importing Image object types from Tiled. The extra data available is: image width, image height, and flags to see if the image is flipped either horizontally, vertically or diagonally (thanks @gotenxds #2564 #2554)
|
||||
* TilemapLayer.renderRegion has had an assignment to the obsolete `tileColor` property removed (thanks @cryptographer #2583)
|
||||
* Group.getFurthestFrom and Group.getClosestTo has a new optional argument: `callback`. This allows you to apply your own additional filtering to the distance checks, ultimately influencing the selected child (thanks @LoneStranger #2577)
|
||||
* Text.setText has a new optional argument `immediate` which will re-create the texture immediately upon call, rather than wait for the next render pass to do so (thanks @Scraft #2594)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -1254,14 +1254,30 @@ Phaser.Text.prototype.componentsToFont = function (components) {
|
|||
* Use a \n to insert a carriage return and split the text.
|
||||
* The text will be rendered with any style currently set.
|
||||
*
|
||||
* Use the optional `immediate` argument if you need the Text display to update immediately.
|
||||
*
|
||||
* If not it will re-create the texture of this Text object during the next time the render
|
||||
* loop is called.
|
||||
*
|
||||
* @method Phaser.Text#setText
|
||||
* @param {string} [text] - The text to be displayed. Set to an empty string to clear text that is already present.
|
||||
* @param {boolean} [immediate=false] - Update the texture used by this Text object immediately (true) or automatically during the next render loop (false).
|
||||
* @return {Phaser.Text} This Text instance.
|
||||
*/
|
||||
Phaser.Text.prototype.setText = function (text) {
|
||||
Phaser.Text.prototype.setText = function (text, immediate) {
|
||||
|
||||
if (immediate === undefined) { immediate = false; }
|
||||
|
||||
this.text = text.toString() || '';
|
||||
|
||||
if (immediate)
|
||||
{
|
||||
this.updateText();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
|
|
2
typescript/phaser.d.ts
vendored
2
typescript/phaser.d.ts
vendored
|
@ -4934,7 +4934,7 @@ declare module Phaser {
|
|||
renderTabLine(line: string, x: number, y: number, fill?: boolean): void;
|
||||
setShadow(x?: number, y?: number, color?: any, blur?: number, shadowStroke?: boolean, shadowFill?: boolean): Phaser.Text;
|
||||
setStyle(style?: PhaserTextStyle, update?: boolean): Phaser.Text;
|
||||
setText(text: string): Phaser.Text;
|
||||
setText(text: string, immediate?: boolean): Phaser.Text;
|
||||
setTextBounds(x?: number, y?: number, width?: number, height?: number): Phaser.Text;
|
||||
update(): void;
|
||||
updateFont(components: any): void;
|
||||
|
|
Loading…
Reference in a new issue