UNPKG

phaser3-rex-plugins

Version:
2 lines (1 loc) 3.4 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextintrgbplugin=e();}(undefined,(function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,i=void 0,"symbol"==typeof(i=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(o,"string"))?i:String(i)),r);}var o,i;}function e(t){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},e(t)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function o(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var o,i=e(t);if(n){var u=e(this).constructor;o=Reflect.construct(i,arguments,u);}else o=i.apply(this,arguments);return r(this,o)}}var i=function(t){return t>>16&255},u=function(t){return t>>8&255},f=function(t){return 255&t};return function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e);}(s,Phaser.Plugins.BasePlugin);var r,c,l=o(s);function s(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),l.call(this,t)}return r=s,(c=[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}},{key:"add",value:function(t,e){return function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var n=i(e),r=u(e),o=f(e);return Object.defineProperty(t,"tint",{get:function(){return e},set:function(c){c=16777215&Math.floor(c),t.setTint&&t.setTint(c),e!==c&&(n=i(e=c),r=u(e),o=f(e));}}),Object.defineProperty(t,"tintR",{get:function(){return n},set:function(r){r=255&Math.floor(r),n!==r&&(n=r,t.tint=(255&r)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return r},set:function(n){n=255&Math.floor(n),r!==n&&(r=n,t.tint=(255&n)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return o},set:function(n){n=255&Math.floor(n),o!==n&&(o=n,t.tint=255&n|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((n+r+o)/3)},set:function(e){e=255&Math.floor(e),n===e&&r===e&&o===e||(n=e,r=e,o=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e,t}(t,e)}}])&&t(r.prototype,c),Object.defineProperty(r,"prototype",{writable:!1}),s}()}));