Skip to content

Commit dcdc219

Browse files
committed
Added flipY support into saveTexture for use in shaders
1 parent 61f5fad commit dcdc219

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/gameobjects/video/Video.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ var Video = new Class({
211211

212212
this.snapshotTexture = null;
213213

214+
this.flipY = false;
215+
214216
this.setPosition(x, y);
215217
this.initPipeline();
216218

@@ -365,6 +367,8 @@ var Video = new Class({
365367
this.setTexture(this.videoTexture);
366368
this.setSizeToFrame();
367369
this.updateDisplayOrigin();
370+
371+
this.emit('created', this, newVideo.videoWidth, newVideo.videoHeight);
368372
}
369373
else
370374
{
@@ -573,11 +577,6 @@ var Video = new Class({
573577

574578
this.video = video;
575579

576-
// if (autoplay)
577-
// {
578-
// this.play(loop);
579-
// }
580-
581580
return this;
582581
},
583582

@@ -838,7 +837,7 @@ var Video = new Class({
838837

839838
if (!this.videoTexture)
840839
{
841-
this.videoTexture = this.scene.sys.textures.create(this._key, video, width, height);
840+
this.videoTexture = this.scene.sys.textures.create(this._key, video, width, height, this.flipY);
842841
this.videoTextureSource = this.videoTexture.source[0];
843842
this.videoTexture.add('__BASE', 0, 0, 0, width, height);
844843

@@ -1181,15 +1180,24 @@ var Video = new Class({
11811180
*
11821181
* @return {Phaser.Textures.Texture} The Texture that was saved.
11831182
*/
1184-
saveTexture: function (key)
1183+
saveTexture: function (key, flipY)
11851184
{
1185+
if (flipY === undefined) { flipY = false; }
1186+
11861187
if (this.videoTexture)
11871188
{
11881189
this.scene.sys.textures.renameTexture(this._key, key);
11891190
}
11901191

11911192
this._key = key;
11921193

1194+
this.flipY = flipY;
1195+
1196+
if (this.videoTextureSource)
1197+
{
1198+
this.videoTextureSource.setFlipY(flipY);
1199+
}
1200+
11931201
return this.videoTexture;
11941202
},
11951203

0 commit comments

Comments
 (0)