From 9c439671ccb85383556f0ac11bd41631c5d6a8e5 Mon Sep 17 00:00:00 2001 From: Rex Date: Thu, 6 Apr 2023 21:20:23 +0800 Subject: [PATCH] Add skipBatch in config parameter of stamp method --- src/textures/DynamicTexture.js | 11 ++++++++++- src/textures/typedefs/StampConfig.js | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/textures/DynamicTexture.js b/src/textures/DynamicTexture.js index 31703fb99..91ac14419 100644 --- a/src/textures/DynamicTexture.js +++ b/src/textures/DynamicTexture.js @@ -450,6 +450,7 @@ var DynamicTexture = new Class({ var originY = GetFastValue(config, 'originY', 0.5); var blendMode = GetFastValue(config, 'blendMode', 0); var erase = GetFastValue(config, 'erase', false); + var skipBatch = GetFastValue(config, 'skipBatch', false); var stamp = this.manager.resetStamp(alpha, tint); @@ -474,7 +475,15 @@ var DynamicTexture = new Class({ this._eraseMode = true; } - this.draw(stamp, x, y); + if (!skipBatch) + { + this.draw(stamp, x, y); + } + else + { + this.batchDraw(stamp, x, y) + } + if (erase) { diff --git a/src/textures/typedefs/StampConfig.js b/src/textures/typedefs/StampConfig.js index 19478221f..d6bda6792 100644 --- a/src/textures/typedefs/StampConfig.js +++ b/src/textures/typedefs/StampConfig.js @@ -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 {(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} [skipBatch=false] - Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw. */