diff --git a/examples/_site/labs/bg.png b/examples/_site/labs/bg.png new file mode 100644 index 00000000..b93c3b6c Binary files /dev/null and b/examples/_site/labs/bg.png differ diff --git a/examples/_site/labs/labs.png b/examples/_site/labs/labs.png new file mode 100644 index 00000000..5d4a20a5 Binary files /dev/null and b/examples/_site/labs/labs.png differ diff --git a/examples/_site/labs/logo.png b/examples/_site/labs/logo.png new file mode 100644 index 00000000..1be30873 Binary files /dev/null and b/examples/_site/labs/logo.png differ diff --git a/examples/wip/animated tilesprite.js b/examples/wip/animated tilesprite.js new file mode 100644 index 00000000..2968f240 --- /dev/null +++ b/examples/wip/animated tilesprite.js @@ -0,0 +1,75 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +var tilesprite; +var cursors; +var count = 0; + +function preload() { + + game.load.image('starfield', 'assets/misc/starfield.jpg'); + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); + game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json'); + +} + +var sprite; + +function create() { + + // sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield'); + // sprite = game.add.tileSprite(100, 100, 400, 300, 'starfield'); + + + // sprite = game.add.tileSprite(0, 0, 800, 600, 'mummy', 0); + // sprite.animations.add('walk'); + // sprite.animations.play('walk', 20, true); + + // x = game.add.sprite(0, 0, 'mummy'); + // x.animations.add('walk'); + // x.animations.play('walk', 20, true); + + sprite = game.add.tileSprite(0, 0, 800, 600, 'seacreatures', 'octopus0000'); + sprite.animations.add('swim', Phaser.Animation.generateFrameNames('octopus', 0, 24, '', 4), 30, true); + sprite.animations.play('swim'); + + + cursors = game.input.keyboard.createCursorKeys(); + +} + +function update() { + + count += 0.005 + + sprite.tileScale.x = 2 + Math.sin(count); + sprite.tileScale.y = 2 + Math.cos(count); + + sprite.tilePosition.x += 1; + sprite.tilePosition.y += 1; + + if (cursors.left.isDown) + { + sprite.tilePosition.x += 4; + } + else if (cursors.right.isDown) + { + sprite.tilePosition.x -= 4; + } + + if (cursors.up.isDown) + { + sprite.tilePosition.y += 4; + } + else if (cursors.down.isDown) + { + sprite.tilePosition.y -= 4; + } + +} + +function render() { + + // game.debug.renderText(sprite.frame, 32, 32); + +} diff --git a/examples/wip/autoscroll.js b/examples/wip/autoscroll.js new file mode 100644 index 00000000..08164fb5 --- /dev/null +++ b/examples/wip/autoscroll.js @@ -0,0 +1,33 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +var tilesprite; +var cursors; +var count = 0; + +function preload() { + + game.load.image('starfield', 'assets/misc/starfield.jpg'); + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); + game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json'); + +} + +var sprite; + +function create() { + + sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield'); + sprite.autoScroll(0, 200); + +} + +function update() { + +} + +function render() { + + // game.debug.renderText(sprite.frame, 32, 32); + +} diff --git a/examples/wip/index.php b/examples/wip/index.php index 9bbc53f6..3c5511da 100644 --- a/examples/wip/index.php +++ b/examples/wip/index.php @@ -32,7 +32,7 @@ function dirToArray($dir) { - $ignore = array('.', '..', '_site', 'assets', 'states', 'book', 'filters', 'misc'); + $ignore = array('.', '..', '_site', 'assets', 'gfx', 'states', 'book', 'filters', 'misc'); $result = array(); $root = scandir($dir); $dirs = array_diff($root, $ignore); diff --git a/examples/wip/tilesprite.js b/examples/wip/tilesprite.js index fad5393b..f4e5d227 100644 --- a/examples/wip/tilesprite.js +++ b/examples/wip/tilesprite.js @@ -1,5 +1,5 @@ -var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); var tilesprite; var cursors; @@ -7,14 +7,24 @@ var cursors; function preload() { game.load.image('starfield', 'assets/misc/starfield.jpg'); + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); + game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json'); } +var sprite; + function create() { - // tilesprite = game.add.tileSprite(0, 0, 800, 600, 'starfield'); + // sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield'); - tilesprite = game.add.tileSprite(100, 100, 400, 300, 'starfield'); + // sprite = game.add.tileSprite(100, 100, 400, 300, 'starfield'); + + sprite = game.add.tileSprite(100, 100, 400, 300, 'mummy'); + + sprite.animations.add('walk'); + + sprite.animations.play('walk', 20, true); cursors = game.input.keyboard.createCursorKeys(); @@ -24,20 +34,28 @@ function update() { if (cursors.left.isDown) { - tilesprite.tilePosition.x += 8; + sprite.tilePosition.x += 8; + sprite.x -= 4; } else if (cursors.right.isDown) { - tilesprite.tilePosition.x -= 8; + sprite.tilePosition.x -= 8; + sprite.x += 4; } if (cursors.up.isDown) { - tilesprite.tilePosition.y += 8; + sprite.tilePosition.y += 8; } else if (cursors.down.isDown) { - tilesprite.tilePosition.y -= 8; + sprite.tilePosition.y -= 8; } } + +function render() { + + game.debug.renderText(sprite.frame, 32, 32); + +} diff --git a/examples/wip/anim2.js b/labs/code/001 under sea.js similarity index 100% rename from examples/wip/anim2.js rename to labs/code/001 under sea.js diff --git a/labs/code/002 animated tilesprites.js b/labs/code/002 animated tilesprites.js new file mode 100644 index 00000000..3607085b --- /dev/null +++ b/labs/code/002 animated tilesprites.js @@ -0,0 +1,70 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +var tilesprite; +var cursors; +var count = 0; + +function preload() { + + game.load.image('starfield', 'assets/misc/starfield.jpg'); + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); + game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json'); + +} + +var sprite; + +function create() { + + // sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield'); + // sprite = game.add.tileSprite(100, 100, 400, 300, 'starfield'); + + sprite = game.add.tileSprite(0, 0, 800, 600, 'mummy'); + sprite.animations.add('walk'); + sprite.animations.play('walk', 20, true); + + // sprite = game.add.tileSprite(0, 0, 800, 600, 'seacreatures'); + // sprite.animations.add('swim', Phaser.Animation.generateFrameNames('octopus', 0, 24, '', 4), 30, true); + // sprite.animations.play('swim'); + + + cursors = game.input.keyboard.createCursorKeys(); + +} + +function update() { + + count += 0.005 + + sprite.tileScale.x = 2 + Math.sin(count); + sprite.tileScale.y = 2 + Math.cos(count); + + sprite.tilePosition.x += 1; + sprite.tilePosition.y += 1; + + if (cursors.left.isDown) + { + sprite.tilePosition.x += 4; + } + else if (cursors.right.isDown) + { + sprite.tilePosition.x -= 4; + } + + if (cursors.up.isDown) + { + sprite.tilePosition.y += 4; + } + else if (cursors.down.isDown) + { + sprite.tilePosition.y -= 4; + } + +} + +function render() { + + // game.debug.renderText(sprite.frame, 32, 32); + +} diff --git a/labs/code/003 thrust.js b/labs/code/003 thrust.js new file mode 100644 index 00000000..08956c20 --- /dev/null +++ b/labs/code/003 thrust.js @@ -0,0 +1,60 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('backdrop', 'assets/pics/remember-me.jpg'); + game.load.image('ship', 'assets/sprites/thrust_ship2.png'); + +} + +var ship; +var cursors; + +function create() { + + game.world.setBounds(0, 0, 1920, 1200); + + var bg = game.add.sprite(0, 0, 'backdrop'); + bg.alpha = 0.8; + + ship = game.add.sprite(200, 200, 'ship'); + ship.physicsEnabled = true; + + game.camera.follow(ship); + + cursors = game.input.keyboard.createCursorKeys(); + + game.physics.defaultRestitution = 0.8; + +} + +function update() { + + if (cursors.left.isDown) + { + ship.body.rotateLeft(100); + } + else if (cursors.right.isDown) + { + ship.body.rotateRight(100); + } + else + { + ship.body.setZeroRotation(); + } + + if (cursors.up.isDown) + { + ship.body.thrust(400); + } + +} + +function render() { + + // game.debug.renderText('x: ' + box2.body.velocity.x, 32, 32); + // game.debug.renderText('y: ' + box2.body.velocity.y, 32, 64); + +} + diff --git a/labs/css/component.css b/labs/css/component.css new file mode 100644 index 00000000..c74a1b5d --- /dev/null +++ b/labs/css/component.css @@ -0,0 +1,123 @@ +*, +*:after, +*::before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +body { + font-family: 'Raleway', sans-serif; + background: #b3c3da url(../../examples/_site/labs/bg.png) repeat-x; + margin: 0; + color: #fff; +} + +#labs { + position: absolute; + width: 172px; + height: 203px; + top: 16px; + left: 16px; + overflow: hidden; + z-index: 1; +} + +#phaser-example { + width: 800px; + margin: 0 auto; + z-index: 10; +} + +#atombender { + background: url(../../examples/_site/labs/bg.png) repeat-x; + height: 579px; + overflow: hidden; + text-align: center; +} + +#photonstorm { + margin: 16px 0px; + color: white; +} + +#photonstorm a { + color: #fff; + margin: 0px 30px 0px 10px; + text-decoration: none; +} + +nav a { + position: relative; + display: inline-block; + margin: 15px 25px; + outline: none; + color: #fff; + text-decoration: none; + text-transform: uppercase; + letter-spacing: 1px; + font-weight: 400; + text-shadow: 0 0 1px rgba(255,255,255,0.3); + font-size: 1.0em; +} + +nav a:hover, +nav a:focus { + outline: none; +} + +/* Effect 2: 3D rolling links, idea from http://hakim.se/thoughts/rolling-links */ +.cl-effect-2 a { + line-height: 44px; + -webkit-perspective: 1000px; + -moz-perspective: 1000px; + perspective: 1000px; +} + +.cl-effect-2 a span { + position: relative; + display: inline-block; + padding: 0 14px; + background: #2195de; + -webkit-transition: -webkit-transform 0.3s; + -moz-transition: -moz-transform 0.3s; + transition: transform 0.3s; + -webkit-transform-origin: 50% 0; + -moz-transform-origin: 50% 0; + transform-origin: 50% 0; + -webkit-transform-style: preserve-3d; + -moz-transform-style: preserve-3d; + transform-style: preserve-3d; +} + +.csstransforms3d .cl-effect-2 a span::before { + position: absolute; + top: 100%; + left: 0; + width: 100%; + height: 100%; + background: #0965a0; + content: attr(data-hover); + -webkit-transition: background 0.3s; + -moz-transition: background 0.3s; + transition: background 0.3s; + -webkit-transform: rotateX(-90deg); + -moz-transform: rotateX(-90deg); + transform: rotateX(-90deg); + -webkit-transform-origin: 50% 0; + -moz-transform-origin: 50% 0; + transform-origin: 50% 0; +} + +.cl-effect-2 a:hover span, +.cl-effect-2 a:focus span { + -webkit-transform: rotateX(90deg) translateY(-22px); + -moz-transform: rotateX(90deg) translateY(-22px); + transform: rotateX(90deg) translateY(-22px); +} + +.csstransforms3d .cl-effect-2 a:hover span::before, +.csstransforms3d .cl-effect-2 a:focus span::before { + background: #28a2ee; +} + diff --git a/labs/css/demo.css b/labs/css/demo.css new file mode 100644 index 00000000..d0c18992 --- /dev/null +++ b/labs/css/demo.css @@ -0,0 +1,39 @@ +@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700|Raleway:400,300,700); + +.container > header, +.codrops-top { + font-family: 'Lato', Arial, sans-serif; +} + +.container > header { + margin: 0 auto; + padding: 2em 0em; + text-align: center; + color: #89867e; +} + +.container > header h1 { + font-size: 2.625em; + line-height: 1.3; + margin: 0; + font-weight: 300; +} + +.container > header span { + display: block; + font-size: 60%; + color: #ceccc6; + padding: 0 0 0.6em 0.1em; +} + +.container > section { + margin: 0 auto; + padding: 1em 3em; + text-align: center; +} + +.color-4 { + background: #72cd22; + background: #0e83cd; +} + diff --git a/labs/css/normalize.css b/labs/css/normalize.css new file mode 100644 index 00000000..77feb205 --- /dev/null +++ b/labs/css/normalize.css @@ -0,0 +1 @@ +article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;} \ No newline at end of file diff --git a/labs/favicon.ico b/labs/favicon.ico new file mode 100644 index 00000000..4498c50e Binary files /dev/null and b/labs/favicon.ico differ diff --git a/labs/index.php b/labs/index.php new file mode 100644 index 00000000..e990b555 --- /dev/null +++ b/labs/index.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/labs/index_local.php b/labs/index_local.php new file mode 100644 index 00000000..ce9fae4e --- /dev/null +++ b/labs/index_local.php @@ -0,0 +1,41 @@ + + + + + + + phaser labs + + + + + + + + + '; + } + ?> + + + +
+ +
+ +
+ +
labs is the playground and test site for phaser.io © 2014 @photonstorm
+
+ +
+ + + \ No newline at end of file diff --git a/labs/index_remote.php b/labs/index_remote.php new file mode 100644 index 00000000..9c4d56e2 --- /dev/null +++ b/labs/index_remote.php @@ -0,0 +1,35 @@ + + + + + + + phaser labs + + + + + + + + + + + +
+ +
+ +
+ +
labs is the playground and test site for phaser.io © 2014 @photonstorm
+
+ +
+ + + \ No newline at end of file diff --git a/labs/js/modernizr.custom.js b/labs/js/modernizr.custom.js new file mode 100644 index 00000000..f63dbbe0 --- /dev/null +++ b/labs/js/modernizr.custom.js @@ -0,0 +1,4 @@ +/* Modernizr 2.6.2 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-csstransforms3d-shiv-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.csstransforms3d=function(){var a=!!F("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f $value) + { + if (is_array($value) && count($value) > 0) + { + $total += count($value); + } + } + + function getFile() { + + global $files, $dir, $filename, $title, $code; + + if (isset($_GET['d']) && isset($_GET['f'])) + { + $dir = urldecode($_GET['d']); + $filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']); + $title = urldecode($_GET['t']); + + if (file_exists($filename)) + { + $code = file_get_contents($filename); + $files = dirToArray($dir); + } + } + + } + + function dirToArray($dir) { + + $ignore = array('.', '..', 'js', 'src', 'css', 'fonts', 'build', 'examples', 'assets'); + $result = array(); + $root = scandir($dir); + $dirs = array_diff($root, $ignore); + + foreach ($dirs as $key => $value) + { + if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) + { + $result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value); + } + else + { + if (substr($value, -3) == '.js') + { + $result[] = $value; + } + } + } + + return $result; + } + + function printJSLinks($files) { + + $output = ""; + + foreach ($files as $key => $value) + { + $value2 = substr($value, 0, -3); + $file = urlencode($value); + + if ($_SERVER['SERVER_NAME'] == '192.168.0.100') + { + $output .= "$value2"; + } + else + { + $output .= "$value2"; + } + } + + return $output; + + } +?> \ No newline at end of file diff --git a/labs/view.php b/labs/view.php new file mode 100644 index 00000000..547b8014 --- /dev/null +++ b/labs/view.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/labs/view_local.php b/labs/view_local.php new file mode 100644 index 00000000..f6da4735 --- /dev/null +++ b/labs/view_local.php @@ -0,0 +1,48 @@ + + + + + + + + phaser labs - <?php echo $f?> + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
labs is the playground and test site for phaser.io © 2014 @photonstorm
+
+ +
+ + + \ No newline at end of file diff --git a/labs/view_remote.php b/labs/view_remote.php new file mode 100644 index 00000000..edbadd17 --- /dev/null +++ b/labs/view_remote.php @@ -0,0 +1,47 @@ + + + + + + + + phaser labs - <?php echo $f?> + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
labs is the playground and test site for phaser.io © 2014 @photonstorm
+
+ +
+ + + \ No newline at end of file diff --git a/src/animation/Animation.js b/src/animation/Animation.js index b28b4e2d..a6193421 100644 --- a/src/animation/Animation.js +++ b/src/animation/Animation.js @@ -162,6 +162,12 @@ Phaser.Animation.prototype = { this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]); this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } + if (this._parent.events) { this._parent.events.onAnimationStart.dispatch(this._parent, this); @@ -259,6 +265,12 @@ Phaser.Animation.prototype = { if (this.currentFrame) { this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } } this._parent.events.onAnimationLoop.dispatch(this._parent, this); @@ -275,6 +287,12 @@ Phaser.Animation.prototype = { if (this.currentFrame) { this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } } } diff --git a/src/animation/AnimationManager.js b/src/animation/AnimationManager.js index 219c5232..4998153a 100644 --- a/src/animation/AnimationManager.js +++ b/src/animation/AnimationManager.js @@ -135,6 +135,12 @@ Phaser.AnimationManager.prototype = { this.currentFrame = this.currentAnim.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } + return this._anims[name]; }, @@ -253,7 +259,6 @@ Phaser.AnimationManager.prototype = { if (this.currentAnim && this.currentAnim.update() === true) { this.currentFrame = this.currentAnim.currentFrame; - this.sprite.currentFrame = this.currentFrame; return true; } @@ -270,7 +275,7 @@ Phaser.AnimationManager.prototype = { */ getAnimation: function (name) { - if (typeof name == 'string') + if (typeof name === 'string') { if (this._anims[name]) { @@ -289,9 +294,14 @@ Phaser.AnimationManager.prototype = { */ refreshFrame: function () { - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } + }, /** @@ -388,8 +398,13 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frame', { { this.currentFrame = this._frameData.getFrame(value); this._frameIndex = value; - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } } } @@ -417,8 +432,13 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', { { this.currentFrame = this._frameData.getFrameByName(value); this._frameIndex = this.currentFrame.index; - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } } else { diff --git a/src/gameobjects/GameObjectFactory.js b/src/gameobjects/GameObjectFactory.js index 7443842e..e07f6777 100644 --- a/src/gameobjects/GameObjectFactory.js +++ b/src/gameobjects/GameObjectFactory.js @@ -145,19 +145,20 @@ Phaser.GameObjectFactory.prototype = { * Creates a new TileSprite object. * * @method Phaser.GameObjectFactory#tileSprite - * @param {number} x - X position of the new tileSprite. - * @param {number} y - Y position of the new tileSprite. - * @param {number} width - the width of the tilesprite. - * @param {number} height - the height of the tilesprite. - * @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. + * @param {number} x - The x coordinate (in world space) to position the TileSprite at. + * @param {number} y - The y coordinate (in world space) to position the TileSprite at. + * @param {number} width - The width of the TileSprite. + * @param {number} height - The height of the TileSprite. + * @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. + * @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index. * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group. * @return {Phaser.TileSprite} The newly created tileSprite object. */ - tileSprite: function (x, y, width, height, key, group) { + tileSprite: function (x, y, width, height, key, frame, group) { if (typeof group === 'undefined') { group = this.world; } - return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key)); + return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame)); }, diff --git a/src/gameobjects/Image.js b/src/gameobjects/Image.js index 7c8fa981..a5690754 100644 --- a/src/gameobjects/Image.js +++ b/src/gameobjects/Image.js @@ -57,7 +57,16 @@ Phaser.Image = function (game, x, y, key, frame) { */ this.key = key; + /** + * @property {number} _frame - Internal cache var. + * @private + */ this._frame = 0; + + /** + * @property {string} _frameName - Internal cache var. + * @private + */ this._frameName = ''; PIXI.Sprite.call(this, PIXI.TextureCache['__default']); diff --git a/src/gameobjects/TileSprite.js b/src/gameobjects/TileSprite.js index bfe115ae..0738d807 100644 --- a/src/gameobjects/TileSprite.js +++ b/src/gameobjects/TileSprite.js @@ -10,27 +10,33 @@ * * @class Phaser.TileSprite * @constructor -* @param {Phaser.Game} game - Current game instance. -* @param {number} [x=0] - X position of the new tileSprite. -* @param {number} [y=0] - Y position of the new tileSprite. -* @param {number} [width=256] - the width of the tilesprite. -* @param {number} [height=256] - the height of the tilesprite. -* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. +* @param {Phaser.Game} game - A reference to the currently running game. +* @param {number} x - The x coordinate (in world space) to position the TileSprite at. +* @param {number} y - The y coordinate (in world space) to position the TileSprite at. +* @param {number} width - The width of the TileSprite. +* @param {number} height - The height of the TileSprite. +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. +* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index. */ -Phaser.TileSprite = function (game, x, y, width, height, key) { +Phaser.TileSprite = function (game, x, y, width, height, key, frame) { x = x || 0; y = y || 0; width = width || 256; height = height || 256; key = key || null; + frame = frame || null; /** - * @property {PIXI.Texture} texture - The texture that the sprite renders with. + * @property {Phaser.Game} game - A reference to the currently running Game. */ - this.texture = PIXI.TextureCache[key]; + this.game = game; - PIXI.TilingSprite.call(this, this.texture, width, height); + /** + * @property {string} name - The user defined name given to this Sprite. + * @default + */ + this.name = ''; /** * @property {number} type - The const type of this object. @@ -38,10 +44,306 @@ Phaser.TileSprite = function (game, x, y, width, height, key) { */ this.type = Phaser.TILESPRITE; - this.position.x = x; - this.position.y = y; + /** + * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components. + */ + this.events = new Phaser.Events(this); + + /** + * @property {Phaser.AnimationManager} animations - This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager) + */ + this.animations = new Phaser.AnimationManager(this); + + /** + * @property {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture. + */ + this.key = key; + + /** + * @property {number} _frame - Internal cache var. + * @private + */ + this._frame = 0; + + /** + * @property {string} _frameName - Internal cache var. + * @private + */ + this._frameName = ''; + + /** + * @property {Phaser.Point} _scroll - Internal cache var. + * @private + */ + this._scroll = new Phaser.Point(); + + PIXI.TilingSprite.call(this, PIXI.TextureCache['__default'], width, height); + + this.loadTexture(key, frame); + + this.position.set(x, y); + + /** + * @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container. + */ + this.world = new Phaser.Point(x, y); }; Phaser.TileSprite.prototype = Object.create(PIXI.TilingSprite.prototype); Phaser.TileSprite.prototype.constructor = Phaser.TileSprite; + +/** +* Automatically called by World.preUpdate. +* +* @method Phaser.TileSprite#preUpdate +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.preUpdate = function() { + + this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); + + this.animations.update(); + + if (this._scroll.x !== 0) + { + this.tilePosition.x += Math.floor(this._scroll.x * this.game.time.physicsElapsed); + } + + if (this._scroll.y !== 0) + { + this.tilePosition.y += Math.floor(this._scroll.y * this.game.time.physicsElapsed); + } + + return true; + +} + +/** +* Internal function called by the World postUpdate cycle. +* +* @method Phaser.TileSprite#postUpdate +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.postUpdate = function() { + + if (this.fixedToCamera) + { + this.position.x = this.game.camera.view.x + this.x; + this.position.y = this.game.camera.view.y + this.y; + } + +} + +/** +* Sets this TileSprite to automatically scroll in the given direction until stopped via TileSprite.stopScroll(). +* The scroll speed is specified in pixels per second. +* A negative x value will scroll to the left. A positive x value will scroll to the right. +* A negative y value will scroll up. A positive y value will scroll down. +* +* @method Phaser.TileSprite#autoScroll +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.autoScroll = function(x, y) { + + this._scroll.set(x, y); + +} + +/** +* Stops an automatically scrolling TileSprite. +* +* @method Phaser.TileSprite#stopScroll +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.stopScroll = function() { + + this._scroll.set(0, 0); + +} + +/** +* Changes the Texture the TileSprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +* This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game. +* +* @method Phaser.TileSprite#loadTexture +* @memberof Phaser.TileSprite +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture. +* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index. +*/ +Phaser.TileSprite.prototype.loadTexture = function (key, frame) { + + frame = frame || 0; + + if (key instanceof Phaser.RenderTexture) + { + this.key = key.key; + this.setTexture(key); + return; + } + else if (key instanceof Phaser.BitmapData) + { + this.key = key.key; + this.setTexture(key.texture); + return; + } + else if (key instanceof PIXI.Texture) + { + this.key = key; + this.setTexture(key); + return; + } + else + { + if (key === null || typeof key === 'undefined') + { + this.key = '__default'; + this.setTexture(PIXI.TextureCache[this.key]); + return; + } + else if (typeof key === 'string' && !this.game.cache.checkImageKey(key)) + { + this.key = '__missing'; + this.setTexture(PIXI.TextureCache[this.key]); + return; + } + + if (this.game.cache.isSpriteSheet(key)) + { + this.key = key; + + // var frameData = this.game.cache.getFrameData(key); + this.animations.loadFrameData(this.game.cache.getFrameData(key)); + + if (typeof frame === 'string') + { + this.frameName = frame; + } + else + { + this.frame = frame; + } + } + else + { + this.key = key; + this.setTexture(PIXI.TextureCache[key]); + return; + } + } + +}; + +/** +* Destroys the TileSprite. This removes it from its parent group, destroys the event and animation handlers if present +* and nulls its reference to game, freeing it up for garbage collection. +* +* @method Phaser.TileSprite#destroy +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.destroy = function() { + + if (this.filters) + { + this.filters = null; + } + + if (this.parent) + { + this.parent.remove(this); + } + + this.animations.destroy(); + + this.events.destroy(); + + this.exists = false; + this.visible = false; + + this.game = null; + +}; + +/** +* Play an animation based on the given key. The animation should previously have been added via sprite.animations.add() +* If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself. +* +* @method Phaser.TileSprite#play +* @memberof Phaser.TileSprite +* @param {string} name - The name of the animation to be played, e.g. "fire", "walk", "jump". +* @param {number} [frameRate=null] - The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used. +* @param {boolean} [loop=false] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used. +* @param {boolean} [killOnComplete=false] - If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed. +* @return {Phaser.Animation} A reference to playing Animation instance. +*/ +Phaser.TileSprite.prototype.play = function (name, frameRate, loop, killOnComplete) { + + return this.animations.play(name, frameRate, loop, killOnComplete); + +}; + +/** +* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle. +* +* @name Phaser.TileSprite#angle +* @property {number} angle - The angle of this Sprite in degrees. +*/ +Object.defineProperty(Phaser.TileSprite.prototype, "angle", { + + get: function() { + + return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation)); + + }, + + set: function(value) { + + this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value)); + + } + +}); + +/** +* @name Phaser.TileSprite#frame +* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display. +*/ +Object.defineProperty(Phaser.TileSprite.prototype, "frame", { + + get: function () { + return this.animations.frame; + }, + + set: function (value) { + + if (value !== this.animations.frame) + { + this.animations.frame = value; + } + + } + +}); + +/** +* @name Phaser.TileSprite#frameName +* @property {string} frameName - Gets or sets the current frame name and updates the Texture Cache for display. +*/ +Object.defineProperty(Phaser.TileSprite.prototype, "frameName", { + + get: function () { + return this.animations.frameName; + }, + + set: function (value) { + + if (value !== this.animations.frameName) + { + this.animations.frameName = value; + } + + } + +}); diff --git a/src/pixi/Pixi.js b/src/pixi/Pixi.js index ea66c5b2..7a3c7b1b 100644 --- a/src/pixi/Pixi.js +++ b/src/pixi/Pixi.js @@ -16,7 +16,7 @@ PIXI.WEBGL_RENDERER = 0; PIXI.CANVAS_RENDERER = 1; // useful for testing against if your lib is using pixi. -PIXI.VERSION = "v1.4.4"; +PIXI.VERSION = "v1.5.0"; // the various blend modes supported by pixi PIXI.blendModes = { diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index c5dc2090..d40cd56c 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -466,8 +466,8 @@ PIXI.Sprite.fromFrame = function(frameId) * @param imageId {String} The image url of the texture * @return {Sprite} A new Sprite using a texture from the texture cache matching the image id */ -PIXI.Sprite.fromImage = function(imageId) +PIXI.Sprite.fromImage = function(imageId, crossorigin, scaleMode) { - var texture = PIXI.Texture.fromImage(imageId); + var texture = PIXI.Texture.fromImage(imageId, crossorigin, scaleMode); return new PIXI.Sprite(texture); }; diff --git a/src/pixi/extras/TilingSprite.js b/src/pixi/extras/TilingSprite.js index 3c444152..f20a0b36 100644 --- a/src/pixi/extras/TilingSprite.js +++ b/src/pixi/extras/TilingSprite.js @@ -371,8 +371,16 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo) { if(isFrame) { - targetWidth = frame.width; - targetHeight = frame.height; + if (texture.trim) + { + targetWidth = texture.trim.width; + targetHeight = texture.trim.height; + } + else + { + targetWidth = frame.width; + targetHeight = frame.height; + } newTextureRequired = true; } diff --git a/src/pixi/primitives/Graphics.js b/src/pixi/primitives/Graphics.js index 78106405..35105d7d 100644 --- a/src/pixi/primitives/Graphics.js +++ b/src/pixi/primitives/Graphics.js @@ -169,6 +169,8 @@ PIXI.Graphics.prototype.lineStyle = function(lineWidth, color, alpha) fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, points:[], type:PIXI.Graphics.POLY}; this.graphicsData.push(this.currentPath); + + return this; }; /** @@ -188,6 +190,8 @@ PIXI.Graphics.prototype.moveTo = function(x, y) this.currentPath.points.push(x, y); this.graphicsData.push(this.currentPath); + + return this; }; /** @@ -202,6 +206,8 @@ PIXI.Graphics.prototype.lineTo = function(x, y) { this.currentPath.points.push(x, y); this.dirty = true; + + return this; }; /** @@ -218,6 +224,8 @@ PIXI.Graphics.prototype.beginFill = function(color, alpha) this.filling = true; this.fillColor = color || 0; this.fillAlpha = (arguments.length < 2) ? 1 : alpha; + + return this; }; /** @@ -230,6 +238,8 @@ PIXI.Graphics.prototype.endFill = function() this.filling = false; this.fillColor = null; this.fillAlpha = 1; + + return this; }; /** @@ -250,6 +260,8 @@ PIXI.Graphics.prototype.drawRect = function( x, y, width, height ) this.graphicsData.push(this.currentPath); this.dirty = true; + + return this; }; /** @@ -271,6 +283,8 @@ PIXI.Graphics.prototype.drawCircle = function( x, y, radius) this.graphicsData.push(this.currentPath); this.dirty = true; + + return this; }; /** @@ -293,6 +307,8 @@ PIXI.Graphics.prototype.drawEllipse = function( x, y, width, height) this.graphicsData.push(this.currentPath); this.dirty = true; + + return this; }; /** @@ -310,6 +326,8 @@ PIXI.Graphics.prototype.clear = function() this.graphicsData = []; this.bounds = null; //new PIXI.Rectangle(); + + return this; }; /** diff --git a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js index 60de6b4f..0a63b343 100644 --- a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js +++ b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js @@ -273,7 +273,7 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite) // set the textures uvs temporarily // TODO create a separate texture so that we can tile part of a texture - if(!tilingSprite._uvs)tilingSprite._uvs = new Float32Array(8); + if(!tilingSprite._uvs)tilingSprite._uvs = new PIXI.TextureUvs(); var uvs = tilingSprite._uvs; @@ -298,7 +298,6 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite) uvs.x3 = 0 - offsetX; uvs.y3 = (1 *scaleY) - offsetY; - // get the tilingSprites current alpha var alpha = tilingSprite.worldAlpha; var tint = tilingSprite.tint; diff --git a/src/pixi/utils/Detector.js b/src/pixi/utils/Detector.js index 3d4b2c3b..dea205af 100644 --- a/src/pixi/utils/Detector.js +++ b/src/pixi/utils/Detector.js @@ -11,11 +11,11 @@ * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view * @param [view] {Canvas} the canvas to use as a view, optional - * @param [antialias=false] {Boolean} sets antialias (only applicable in webGL chrome at the moment) * @param [transparent=false] {Boolean} the transparency of the render view, default false + * @param [antialias=false] {Boolean} sets antialias (only applicable in webGL chrome at the moment) * */ -PIXI.autoDetectRenderer = function(width, height, view,antialias,transparent) +PIXI.autoDetectRenderer = function(width, height, view, transparent, antialias) { if(!width)width = 800; if(!height)height = 600; diff --git a/src/pixi/utils/EventTarget.js b/src/pixi/utils/EventTarget.js index a772a44c..300d2877 100644 --- a/src/pixi/utils/EventTarget.js +++ b/src/pixi/utils/EventTarget.js @@ -11,7 +11,7 @@ * Adds event emitter functionality to a class * * @class EventTarget - * + * @example * function MyEmitter() { * PIXI.EventTarget.call(this); //mixes in event target stuff * }