mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Added Text.setResolution methods.
This commit is contained in:
parent
1b9f5dc76d
commit
14ba51d928
3 changed files with 47 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
### New Features
|
||||
|
||||
* `Camera.resolution` is a new read-only property that holds the current game config resolution that the camera is using. This is used internally for viewport calculations.
|
||||
* `Text.resolution` and the method `Text.setResolution` allows you to control the resolution of a Static Text Game Object. By default it will be set to match the resolution set in the Game Config, but you can override it yourself via the TextStyle. It allows for much clearer text on High DPI devices, at the cost of larger internal Canvas textures for the Text - so please use with caution, as the more high res Text you have, the more memory it uses up. Fix #3528 (thanks @kirillbunin)
|
||||
|
||||
### Updates
|
||||
|
||||
|
|
|
@ -687,6 +687,29 @@ var TextStyle = new Class({
|
|||
return this.update(false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the resolution used by the Text object.
|
||||
*
|
||||
* By default it will be set to match the resolution set in the Game Config,
|
||||
* but you can override it via this method. It allows for much clearer text on High DPI devices,
|
||||
* at the cost of memory because it uses larger internal Canvas textures for the Text.
|
||||
*
|
||||
* Please use with caution, as the more high res Text you have, the more memory it uses up.
|
||||
*
|
||||
* @method Phaser.GameObjects.Text.TextStyle#setResolution
|
||||
* @since 3.12.0
|
||||
*
|
||||
* @param {number} value - The resolution for this Text object to use.
|
||||
*
|
||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||
*/
|
||||
setResolution: function (value)
|
||||
{
|
||||
this.resolution = value;
|
||||
|
||||
return this.update(false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the stroke settings.
|
||||
*
|
||||
|
|
|
@ -853,6 +853,29 @@ var Text = new Class({
|
|||
return this.style.setAlign(align);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the resolution used by this Text object.
|
||||
*
|
||||
* By default it will be set to match the resolution set in the Game Config,
|
||||
* but you can override it via this method, or by specifying it in the Text style configuration object.
|
||||
*
|
||||
* It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger
|
||||
* internal Canvas textures for the Text.
|
||||
*
|
||||
* Therefore, please use with caution, as the more high res Text you have, the more memory it uses.
|
||||
*
|
||||
* @method Phaser.GameObjects.Text#setResolution
|
||||
* @since 3.12.0
|
||||
*
|
||||
* @param {number} value - The resolution for this Text object to use.
|
||||
*
|
||||
* @return {Phaser.GameObjects.Text} This Text object.
|
||||
*/
|
||||
setResolution: function (value)
|
||||
{
|
||||
return this.style.setResolution(value);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the text padding.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue