Add skipBatch in config parameter of stamp method

This commit is contained in:
Rex 2023-04-06 21:20:23 +08:00
parent afe5401a25
commit 9c439671cc
2 changed files with 11 additions and 1 deletions

View file

@ -450,6 +450,7 @@ var DynamicTexture = new Class({
var originY = GetFastValue(config, 'originY', 0.5); var originY = GetFastValue(config, 'originY', 0.5);
var blendMode = GetFastValue(config, 'blendMode', 0); var blendMode = GetFastValue(config, 'blendMode', 0);
var erase = GetFastValue(config, 'erase', false); var erase = GetFastValue(config, 'erase', false);
var skipBatch = GetFastValue(config, 'skipBatch', false);
var stamp = this.manager.resetStamp(alpha, tint); var stamp = this.manager.resetStamp(alpha, tint);
@ -474,7 +475,15 @@ var DynamicTexture = new Class({
this._eraseMode = true; this._eraseMode = true;
} }
if (!skipBatch)
{
this.draw(stamp, x, y); this.draw(stamp, x, y);
}
else
{
this.batchDraw(stamp, x, y)
}
if (erase) if (erase)
{ {

View file

@ -15,4 +15,5 @@
* @property {number} [originY=0.5] - The vertical origin of the stamp. 0 is the top, 0.5 is the center and 1 is the bottom. * @property {number} [originY=0.5] - The vertical origin of the stamp. 0 is the top, 0.5 is the center and 1 is the bottom.
* @property {(string|Phaser.BlendModes|number)} [blendMode=0] - The blend mode used when drawing the stamp. Defaults to 0 (normal). * @property {(string|Phaser.BlendModes|number)} [blendMode=0] - The blend mode used when drawing the stamp. Defaults to 0 (normal).
* @property {boolean} [erase=false] - Erase this stamp from the texture? * @property {boolean} [erase=false] - Erase this stamp from the texture?
* @property {boolean} [skipBatch=false] - Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw.
*/ */