forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed the FX project as it's no longer needed and tidied up the bui…
…ld folder.
- Loading branch information
1 parent
1195481
commit a7873a3
Showing
50 changed files
with
580 additions
and
76,519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var __extends = this.__extends || function (d, b) { | ||
function __() { this.constructor = d; } | ||
__.prototype = b.prototype; | ||
d.prototype = new __(); | ||
}; | ||
var Phaser; | ||
(function (Phaser) { | ||
(function (Plugins) { | ||
/// <reference path="../../Phaser/Game.ts" /> | ||
/// <reference path="../../Phaser/core/Plugin.ts" /> | ||
/** | ||
* Phaser - Plugins - Camera FX - Border | ||
* | ||
* Creates a border around a camera. | ||
*/ | ||
(function (CameraFX) { | ||
var Border = (function (_super) { | ||
__extends(Border, _super); | ||
function Border(game, parent) { | ||
_super.call(this, game, parent); | ||
/** | ||
* Whether render border of this camera or not. (default is false) | ||
* @type {boolean} | ||
*/ | ||
this.showBorder = false; | ||
/** | ||
* Color of border of this camera. (in css color string) | ||
* @type {string} | ||
*/ | ||
this.borderColor = 'rgb(255,255,255)'; | ||
this.camera = parent; | ||
} | ||
Border.prototype.postRender = function () { | ||
if(this.showBorder == true) { | ||
this.game.stage.context.strokeStyle = this.borderColor; | ||
this.game.stage.context.lineWidth = 1; | ||
this.game.stage.context.rect(this.camera.x, this.camera.y, this.camera.width, this.camera.height); | ||
this.game.stage.context.stroke(); | ||
} | ||
}; | ||
return Border; | ||
})(Phaser.Plugin); | ||
CameraFX.Border = Border; | ||
})(Plugins.CameraFX || (Plugins.CameraFX = {})); | ||
var CameraFX = Plugins.CameraFX; | ||
})(Phaser.Plugins || (Phaser.Plugins = {})); | ||
var Plugins = Phaser.Plugins; | ||
})(Phaser || (Phaser = {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/// <reference path="../../Phaser/Game.ts" /> | ||
/// <reference path="../../Phaser/core/Plugin.ts" /> | ||
|
||
/** | ||
* Phaser - Plugins - Camera FX - Border | ||
* | ||
* Creates a border around a camera. | ||
*/ | ||
|
||
module Phaser.Plugins.CameraFX { | ||
|
||
export class Border extends Phaser.Plugin { | ||
|
||
constructor(game: Phaser.Game, parent) { | ||
|
||
super(game, parent); | ||
this.camera = parent; | ||
|
||
} | ||
|
||
public camera: Phaser.Camera; | ||
|
||
/** | ||
* Whether render border of this camera or not. (default is false) | ||
* @type {boolean} | ||
*/ | ||
public showBorder: bool = false; | ||
|
||
/** | ||
* Color of border of this camera. (in css color string) | ||
* @type {string} | ||
*/ | ||
public borderColor: string = 'rgb(255,255,255)'; | ||
|
||
public postRender() { | ||
|
||
if (this.showBorder == true) | ||
{ | ||
this.game.stage.context.strokeStyle = this.borderColor; | ||
this.game.stage.context.lineWidth = 1; | ||
this.game.stage.context.rect(this.camera.x, this.camera.y, this.camera.width, this.camera.height); | ||
this.game.stage.context.stroke(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
var __extends = this.__extends || function (d, b) { | ||
function __() { this.constructor = d; } | ||
__.prototype = b.prototype; | ||
d.prototype = new __(); | ||
}; | ||
var Phaser; | ||
(function (Phaser) { | ||
(function (Plugins) { | ||
/// <reference path="../../Phaser/Game.ts" /> | ||
/// <reference path="../../Phaser/core/Plugin.ts" /> | ||
/** | ||
* Phaser - Plugins - Camera FX - Fade | ||
* | ||
* The camera is filled with the given color and returns to normal at the given duration. | ||
*/ | ||
(function (CameraFX) { | ||
var Fade = (function (_super) { | ||
__extends(Fade, _super); | ||
function Fade(game, parent) { | ||
_super.call(this, game, parent); | ||
this._fxFadeComplete = null; | ||
this._fxFadeDuration = 0; | ||
this._fxFadeAlpha = 0; | ||
this.camera = parent; | ||
} | ||
Fade.prototype.start = /** | ||
* The camera is gradually filled with this color. | ||
* | ||
* @param Color The color you want to use in 0xRRGGBB format, i.e. 0xffffff for white. | ||
* @param Duration How long it takes for the flash to fade. | ||
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback. | ||
* @param Force Force an already running flash effect to reset. | ||
*/ | ||
function (color, duration, onComplete, force) { | ||
if (typeof color === "undefined") { color = 0x000000; } | ||
if (typeof duration === "undefined") { duration = 1; } | ||
if (typeof onComplete === "undefined") { onComplete = null; } | ||
if (typeof force === "undefined") { force = false; } | ||
if(force === false && this._fxFadeAlpha > 0) { | ||
// You can't fade again unless you force it | ||
return; | ||
} | ||
if(duration <= 0) { | ||
duration = 1; | ||
} | ||
var red = color >> 16 & 0xFF; | ||
var green = color >> 8 & 0xFF; | ||
var blue = color & 0xFF; | ||
this._fxFadeColor = 'rgba(' + red + ',' + green + ',' + blue + ','; | ||
this._fxFadeDuration = duration; | ||
this._fxFadeAlpha = 0.01; | ||
this._fxFadeComplete = onComplete; | ||
}; | ||
Fade.prototype.postUpdate = function () { | ||
// Update the Fade effect | ||
if(this._fxFadeAlpha > 0) { | ||
this._fxFadeAlpha += this.game.time.elapsed / this._fxFadeDuration; | ||
if(this.game.math.roundTo(this._fxFadeAlpha, -2) >= 1) { | ||
this._fxFadeAlpha = 1; | ||
if(this._fxFadeComplete !== null) { | ||
this._fxFadeComplete(); | ||
} | ||
} | ||
} | ||
}; | ||
Fade.prototype.postRender = function () { | ||
// "Fade" FX | ||
if(this._fxFadeAlpha > 0) { | ||
this.game.stage.context.fillStyle = this._fxFadeColor + this._fxFadeAlpha + ')'; | ||
this.game.stage.context.fillRect(this.camera.screenView.x, this.camera.screenView.y, this.camera.width, this.camera.height); | ||
} | ||
}; | ||
return Fade; | ||
})(Phaser.Plugin); | ||
CameraFX.Fade = Fade; | ||
})(Plugins.CameraFX || (Plugins.CameraFX = {})); | ||
var CameraFX = Plugins.CameraFX; | ||
})(Phaser.Plugins || (Phaser.Plugins = {})); | ||
var Plugins = Phaser.Plugins; | ||
})(Phaser || (Phaser = {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
var __extends = this.__extends || function (d, b) { | ||
function __() { this.constructor = d; } | ||
__.prototype = b.prototype; | ||
d.prototype = new __(); | ||
}; | ||
var Phaser; | ||
(function (Phaser) { | ||
(function (Plugins) { | ||
/// <reference path="../../Phaser/Game.ts" /> | ||
/// <reference path="../../Phaser/core/Plugin.ts" /> | ||
/** | ||
* Phaser - Plugins - Camera FX - Flash | ||
* | ||
* The camera is filled with the given color and returns to normal at the given duration. | ||
*/ | ||
(function (CameraFX) { | ||
var Flash = (function (_super) { | ||
__extends(Flash, _super); | ||
function Flash(game, parent) { | ||
_super.call(this, game, parent); | ||
this._fxFlashComplete = null; | ||
this._fxFlashDuration = 0; | ||
this._fxFlashAlpha = 0; | ||
this.camera = parent; | ||
} | ||
Flash.prototype.start = /** | ||
* The camera is filled with this color and returns to normal at the given duration. | ||
* | ||
* @param Color The color you want to use in 0xRRGGBB format, i.e. 0xffffff for white. | ||
* @param Duration How long it takes for the flash to fade. | ||
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback. | ||
* @param Force Force an already running flash effect to reset. | ||
*/ | ||
function (color, duration, onComplete, force) { | ||
if (typeof color === "undefined") { color = 0xffffff; } | ||
if (typeof duration === "undefined") { duration = 1; } | ||
if (typeof onComplete === "undefined") { onComplete = null; } | ||
if (typeof force === "undefined") { force = false; } | ||
if(force === false && this._fxFlashAlpha > 0) { | ||
// You can't flash again unless you force it | ||
return; | ||
} | ||
if(duration <= 0) { | ||
duration = 1; | ||
} | ||
var red = color >> 16 & 0xFF; | ||
var green = color >> 8 & 0xFF; | ||
var blue = color & 0xFF; | ||
this._fxFlashColor = 'rgba(' + red + ',' + green + ',' + blue + ','; | ||
this._fxFlashDuration = duration; | ||
this._fxFlashAlpha = 1; | ||
this._fxFlashComplete = onComplete; | ||
}; | ||
Flash.prototype.postUpdate = function () { | ||
// Update the Flash effect | ||
if(this._fxFlashAlpha > 0) { | ||
this._fxFlashAlpha -= this.game.time.elapsed / this._fxFlashDuration; | ||
if(this.game.math.roundTo(this._fxFlashAlpha, -2) <= 0) { | ||
this._fxFlashAlpha = 0; | ||
if(this._fxFlashComplete !== null) { | ||
this._fxFlashComplete(); | ||
} | ||
} | ||
} | ||
}; | ||
Flash.prototype.postRender = function () { | ||
if(this._fxFlashAlpha > 0) { | ||
this.game.stage.context.fillStyle = this._fxFlashColor + this._fxFlashAlpha + ')'; | ||
this.game.stage.context.fillRect(this.camera.screenView.x, this.camera.screenView.y, this.camera.width, this.camera.height); | ||
} | ||
}; | ||
return Flash; | ||
})(Phaser.Plugin); | ||
CameraFX.Flash = Flash; | ||
})(Plugins.CameraFX || (Plugins.CameraFX = {})); | ||
var CameraFX = Plugins.CameraFX; | ||
})(Phaser.Plugins || (Phaser.Plugins = {})); | ||
var Plugins = Phaser.Plugins; | ||
})(Phaser || (Phaser = {})); |
Oops, something went wrong.