UNPKG

phaser-ce

Version:

Phaser CE (Community Edition) is a fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

63 lines (53 loc) 1.41 kB
/** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** * @class PIXI.WebGLBlendModeManager * @constructor * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLBlendModeManager = function () { /** * @property currentBlendMode * @type Number */ this.currentBlendMode = 99999; }; PIXI.WebGLBlendModeManager.prototype.constructor = PIXI.WebGLBlendModeManager; /** * Sets the WebGL Context. * * @method PIXI.WebGLBlendModeManager#setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLBlendModeManager.prototype.setContext = function (gl) { this.gl = gl; }; /** * Sets-up the given blendMode from WebGL's point of view. * * @method PIXI.WebGLBlendModeManager#setBlendMode * @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD */ PIXI.WebGLBlendModeManager.prototype.setBlendMode = function (blendMode) { if(this.currentBlendMode === blendMode) { return false; } this.currentBlendMode = blendMode; var blendModeWebGL = PIXI.blendModesWebGL[this.currentBlendMode]; if (blendModeWebGL) { this.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); } return true; }; /** * Destroys this object. * * @method PIXI.WebGLBlendModeManager#destroy */ PIXI.WebGLBlendModeManager.prototype.destroy = function () { this.gl = null; };