diff --git a/README.md b/README.md index 5c2daaefe..fa1cc844e 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,20 @@ -![Phaser Logo](http://www.photonstorm.com/wp-content/uploads/2013/09/phaser_10_release.jpg) +![Phaser 2.0](http://www.phaser.io/images/phaser2-github.png) -Phaser 2.0.0-dev -================ +Phaser 2.0.0 +============ Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering. -Version: 2.0.0 "Aes Sedai" - Released: -in development- +Version: 2.0.0 "Aes Sedai" - Released: March 13th 2014 By Richard Davey, [Photon Storm](http://www.photonstorm.com) * View the [Official Website](http://phaser.io) * Follow on [Twitter](https://twitter.com/photonstorm) * Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/) -* Try out 220+ [Phaser Examples](http://examples.phaser.io) +* Source code for 250+ [Phaser Examples](https://github.com/photonstorm/phaser-examples) * Read the [documentation online](http://docs.phaser.io) +* Browse the [Examples online](http://examples.phaser.io) * Join our [#phaserio IRC channel](http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/) on freenode [Subscribe to our new Phaser Newsletter](https://confirmsubscription.com/h/r/369DE48E3E86AF1E). We'll email you when new versions are released as well as send you our regular Phaser game making magazine. @@ -24,7 +25,17 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com) Welcome to Phaser ----------------- -Phaser 2.0 "welcome" text to go here. +Exactly 6 months ago we released Phaser 1.0 into the world. Suffice to say that since then we've been overwhelmed at the huge surge of developers taking to it! Our github repository is consistently in the top JavaScript lists, we've over 3200 stars at the time of writing, and a wonderful, vibrant and friendly community. Phaser 2 is a natural evolution of what we started. We've focused specifically on performance and expansion with this release. Lots of developers have already reported to us considerably speed increases just by swapping to Phaser 2 (reports of 200% faster speeds on mobile aren't unheard of!). There's also a full-body physics system available now, in the form of the excellent p2.js. The upgrade to Pixi 1.5 under the hood bought lots of new visual effects in, including blend modes and tints. + +And we're also really pleased to have closed down over 550 issues reported on github. We literally went through every last bug reported to us, and fixed it. All kinds of little things that as a whole make the library that much more solid. With the 2.0 release we're now freezing the API. Before we have to admit that the API changed somewhat on a whim, and we moved things around and changed things without too much consideration for fellow developers. With 2.0 that stops - we've spent long enough on this release that we're now extremely happy with the organisation of classes and methods, and while we may still need to make small tweaks in the future, none of them will be API breaking without prior community approval first. This means if you're using Phaser to teach in classes, or writing a book / tutorials around it, this is the version to base off. + +If you want to port a Phaser 1.x game over to 2 then please see our [Migration Guide]() for help. + +So what's next? We do have a roadmap (which you can find at the bottom of this document), but we're going to sit back and take stock for a while, building up the tutorials and sample games. We will of course jump on bug fixes quickly, and we appreciate that our TypeScript definitions are now slightly out of date again (an eternal quest we appear to be on!), but this is definitely the best release of Phaser ever. The most features, the fastest, the most stable and just generally the most fun to use. + +Happy coding everyone! See you on the forums. + +![boogie](http://www.phaser.io/images/spacedancer.gif) Getting Started Guides @@ -37,61 +48,14 @@ There is a comprehensive [How to Learn Phaser](http://gamedevelopment.tutsplus.c There is also an [un-official Getting Started Guide](http://www.antonoffplus.com/coding-an-html5-game-for-30-minutes-or-an-introduction-to-the-phaser-framework). +![Phaser Logo](http://www.photonstorm.com/wp-content/uploads/2013/09/phaser_10_release.jpg) + Change Log ---------- -Version 2.0.0 - "Aes Sedai" - -in development- - -Significant API changes: - -* Upgraded to Pixi.js 1.5.5 -* Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting and child iteration. -* Removed Sprite.group property. You can use Sprite.parent for all similar needs now. -* PIXI.Point is now aliased to Phaser.Point - saves on code duplication and works exactly the same. -* PIXI.Rectangle is now aliased to Phaser.Rectangle - saves on code duplication and works exactly the same. -* PIXI.Circle is now aliased to Phaser.Circle - saves on code duplication and works exactly the same. -* Sprite.deltaX and deltaY swapped to functions: Sprite.deltaX() and Sprite.deltaY() -* Sprite.crop() now takes a Phaser.Rectangle instead of explicit parameters. -* PixiPatch no longer needed, all features that it patched are now native in Pixi :) -* Removed: Sprite.offset, center, topLeft, topRight, bottomRight, bottomLeft and bounds, as no longer needed internally. Use Sprite.getBounds() to derive them. -* Button now extends Phaser.Image not Phaser.Sprite, all the same functionality as before remains, just no animations or physics body. -* Text.content has been replaced with Text.text. The Text class has a lot of new methods, check the docs! -* Loader won't set crossOrigin on Images unless it's set to something. The default is false, it used to be '' and can be any valid string. -* Sprite.input.pixelPerfect has been split into two: Sprite.input.pixelPerfectClick and Sprite.input.pixelPerfectOver (see new features) -* Phaser.Stage now extends PIXI.Stage, rather than containing a _stage object. -* If you set Sprite.exists to false it will also set Sprite.visible to false and remove its body from the physics world (if it has one). -* If you set Sprite.exists to true it will also set Sprite.visible to true and add its body back into the physics world (if it has one). -* Stage.scale has been moved to Game.scale. The same game scaling properties exist as before, but now accessed via Game.scale instead. -* Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio) -* Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode) -* Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode) -* Stage.canvas has been moved to Game.canvas (which used to be a reference to Stage.canvas, but is now the actual object). -* BitmapData.addTo removed and enhanced BitmapData.add so it can accept either a single Sprite/Image or an Array of them. -* BitmapData has had all of the EaselJS functions removed. It was just taking up space and you can do it all via BitmapData.context directly. -* BitmapText has had a bit of an overhaul - the signature for adding a BitmapText has changed to: x, y, font, text, size. See the docs and examples for details. -* World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live. -* Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types. -* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required. -* Phaser.QuadTree has been made more generic and works with any rectangle, not just physics bodies. -* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas. -* When adding a Group if the parent value is `null` the Group won't be added to the World, so you can add it when ready. If parent is `undefined` it's added by default. -* The Keyboard class has had a complete overhaul. Phaser.Key objects are created automatically, there are fixes against duration and keys reset properly on visibility loss. -* Keyboard.removeKey has been removed. The way the new keyboard manager works means it's no longer required. -* When a game un-pauses (from a visibility loss) it resets all Input components. -* Time.advancedTiming is a new boolean property. If true Time.fps, fpsMin, fpsMax, frames, msMin and msMax will be calculated, otherwise they remain at their defaults. -* Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale. -* If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL. -* Time.physicsElapsed is no longer bound or clamped, be wary of this if you use the value anywhere in your code. -* In Group.destroy the default for 'destroyChildren' was false. It's now `true` as this is a far more likely requirement when destroying a Group. -* Game no longer pauses if you've forced orientation and change it, also doesn't resize a NO_SCALE game. -* All the Debug methods have had the word 'render' removed from the start. So where you did `debug.renderSpriteInfo` before, it's now just `debug.spriteInfo`. -* Debug methods that rendered geometry (Rectangle, Circle, Line, Point) have been merged into the single method: `Debug.geom`. -* Animation.looped has been renamed to Animation.loop. It's a boolean you can toggle at run-time to turn on/off animation looping. -* Sprite.damage will now kill the Sprite if health is less than or equal to 0 (before it would only kill if less than zero) -* By default Sprites no longer check if they are within the world bounds. It's quite an expensive process (calling getBounds every frame), so you have to enable directly. -* The main Game class has been modified so that the update methods no longer have any if/else checks in them. Now split into coreUpdate, etc. -* RandomDataGenerator is now started on Game creation instead of boot. You can pass a seed array in the game config object (feature request #547) +Version 2.0.0 - "Aes Sedai" - March 13th 2014 +There is an extensive Migration Guide available. In the guide we detail the API breaking changes and approach to our new physics system. The following is a list of all the other new features, updates and bug fixes present in this release. New features: @@ -239,12 +203,6 @@ Bug Fixes: * Cache.destroy fixed to clear up properly (thanks Dumtard, #537) -TO DO: - -* If you change the frame name of a pixel precise input Sprite, it will fail all clicks on it after the frame change. - - - You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md @@ -297,13 +255,19 @@ Games created with Phaser require a modern web browser that supports the canvas For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/) using the provided TypeScript definitions file. We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you. -Phaser is 321 KB minified and 72 KB gzipped. +Phaser is 576 KB minified (including all 3 physics engines, 311KB without) and 128 KB gzipped (67KB without). Learn By Example ---------------- -Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 200 of them and create new ones to test every new feature added. Inside the `examples` folder you'll find the current set. If you write a particularly good example then please send it to us. +Ever since we started Phaser we've been growing and expanding our extensive set of Examples. Currently over 250 of them! + +They used to be bundled in the main Phaser repo, but because they got so large and in order to help with versioning we've moved them to their own repo. + +Please go and checkout https://github.com/photonstorm/phaser-examples + +Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 250 of them and create new ones to test every new feature added. Inside the `examples` repo you'll find the current set. If you write a particularly good example then please send it to us. The examples need to be run through a local web server (in order to avoid file access permission errors from your browser). You can use your own web server, or start the included web server using grunt. @@ -315,7 +279,7 @@ Alternatively in order to start the included web server, after you've cloned the There is a new 'Side View' example viewer as well. This loads all the examples into a left-hand frame for faster navigation. -You can also browse all [Phaser Examples](http://gametest.mobi/phaser/) online. +You can also browse all [Phaser Examples](http://examples.phaser.io) online. Features @@ -331,7 +295,7 @@ We've made the loading of assets as simple as one line of code. Images, Sounds, **Physics** -Phaser ships with our Arcade Physics system. A SAT based collision and physics library perfect for low-powered devices and fast collision response. Control velocity, acceleration, bounce, damping and full collision and separation control. As of version 1.1.4 we now support rectangles, circles and polygon collision with full rotation. +Phaser ships with our Arcade Physics system, Ninja Physics and P2.JS - a full body physics system. Arcade Physics is for high-speed AABB collision only. Ninja Physics allows for complex tiles and slopes, perfect for level scenery, and P2.JS is a full-body physics system, with constraints, springs, polygon support and more. **Sprites** @@ -384,7 +348,7 @@ We use Phaser every day on our many client projects. As a result it's constantly **Battle Tested** -Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest mobile HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved fast and we stay on-top of the changing browser landscape. +Phaser has been used to create hundreds of games, which receive millions of plays per month. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved fast and we stay on-top of the changing browser landscape. ![FruitParty](http://www.photonstorm.com/wp-content/uploads/2013/10/phaser_fruit_particles-640x480.png) diff --git a/examples/_site/css/desert.css b/examples/_site/css/desert.css deleted file mode 100644 index 89bc279b5..000000000 --- a/examples/_site/css/desert.css +++ /dev/null @@ -1,34 +0,0 @@ -/* desert scheme ported from vim to google prettify */ -pre.prettyprint { display: block; background-color: #333 } -pre .nocode { background-color: none; color: #000 } -pre .str { color: #ffa0a0 } /* string - pink */ -pre .kwd { color: #f0e68c; font-weight: bold } -pre .com { color: #87ceeb } /* comment - skyblue */ -pre .typ { color: #98fb98 } /* type - lightgreen */ -pre .lit { color: #cd5c5c } /* literal - darkred */ -pre .pun { color: #fff } /* punctuation */ -pre .pln { color: #fff } /* plaintext */ -pre .tag { color: #f0e68c; font-weight: bold } /* html/xml tag - lightyellow */ -pre .atn { color: #bdb76b; font-weight: bold } /* attribute name - khaki */ -pre .atv { color: #ffa0a0 } /* attribute value - pink */ -pre .dec { color: #98fb98 } /* decimal - lightgreen */ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */ -li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none } -/* Alternate shading for lines */ -li.L1,li.L3,li.L5,li.L7,li.L9 { } - -@media print { - pre.prettyprint { background-color: none } - pre .str, code .str { color: #060 } - pre .kwd, code .kwd { color: #006; font-weight: bold } - pre .com, code .com { color: #600; font-style: italic } - pre .typ, code .typ { color: #404; font-weight: bold } - pre .lit, code .lit { color: #044 } - pre .pun, code .pun { color: #440 } - pre .pln, code .pln { color: #000 } - pre .tag, code .tag { color: #006; font-weight: bold } - pre .atn, code .atn { color: #404 } - pre .atv, code .atv { color: #060 } -} \ No newline at end of file diff --git a/examples/_site/css/phaser-examples.css b/examples/_site/css/phaser-examples.css deleted file mode 100644 index c3ffec32b..000000000 --- a/examples/_site/css/phaser-examples.css +++ /dev/null @@ -1,196 +0,0 @@ -/* reset css starts */ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline;} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;} -body {line-height: 1;} -ol, ul {list-style: none;} -blockquote, q {quotes: none;} -blockquote:before, blockquote:after, q:before, q:after {content: ''; content: none;} -table {border-collapse: collapse; border-spacing: 0;} -/* reset css ends */ -@font-face{font-family: 'HelveticaBd'; src: url('../../_site/fonts/HelveticaNeueLTStd-Bd.otf');} - -body { margin:0; padding:0; overflow-x: hidden; font-family: Arial, Tahoma, Verdana !important; background: #e0e4f1;} - -a{color:#fff; text-decoration: none;} -a:hover{text-decoration: underline;} - -.helvetica{font-family: Arial, Tahoma, Verdana !important;} -.header{background: #e0e4f1 url('../../_site/images/header-bg2.jpg') no-repeat; width:100%; margin:0; padding:0; background-size: cover; height: 530px; display: block; clear:both; margin-bottom: -400px} -.main-container{display: block; clear:both; width: 1125px; height: auto; margin:0 auto;} - -ul.nav-links{ margin:0; padding:0; display: inline-block; float: right; list-style-type: none; color: #fff; font-size: 15px; line-height: 2em; margin-top: 50px; min-width: 180px;} -ul.nav-links > li{margin:0; padding:0; list-style-type: none; padding-left: 55px;} -ul.nav-links > li > a{color: #fff; text-decoration: none;} -ul.nav-links > li > a:hover{text-decoration: underline;} -.link-home, .link-latest, .link-forum, .link-docs, .link-twitter{background-image: url('../../_site/images/nav-icons.png'); background-repeat: no-repeat;} - -.main-title{font-family: 'HelveticaBd', Helvetica, Arial;font-size:55px;color:#fff;text-shadow:0 0 15px #b643e6; text-align: center; display: block; margin: 40px auto 0 auto;} -.link-home{background-position: 0 -9px;} -.link-latest{background-position: 0 -37px;} -.link-forum{background-position: 0 -67px;} -.link-docs{background-position: 0 -97px;} -.link-twitter{background-position: 0 -127px;} -.phaser-examples{background: url('../../_site/images/phaser-examples.png') no-repeat; display: block; width: 485px; height: 205px; margin: 20px auto;} -.phaser-version{float: right; background: url('../../_site/images/phaser-version.png') no-repeat; display: block; width: 345px; height: 30px; color: #fff; font-size: 11px; text-shadow: 1px 1px #000; right:0; top:0; } -.phaser-version > span{margin-top: 10px; display: inline-block; margin-left: 60px; margin-right: 25px;} -.phaser-version > a {color: #fff; text-decoration: none; background: url('../../_site/images/version-button.png') no-repeat; background-size: cover; display: inline-block; width: 123px; height: 10px; vertical-align: middle; text-align: center;padding-top:11px; padding-bottom: 11px} -.phaser-version > a:hover{text-decoration: underline;} -.phaser-logo{display: block; float: right; width: 168px;height: 144px; background: url('../../_site/images/phaser-logo.png') no-repeat; margin-top: 40px; margin-right: 40px;} - -#upgrade { - display: none; -} - -#welcome { - position: absolute; - top: 260px; - left: 40%; - width: 200px; - line-height: 28px; -} - -#welcome p { - text-align: center; - text-shadow: 1px 1px 0 #fff; -} - -#welcome a { - color: #7a50c4; -} - -.error { margin-left: 48px; width: 700px; background-color: rgb(150,25,25); color:#fff; text-shadow: 1px 1px 0 #000; line-height: 24px } - -.error p { - padding: 16px 24px; -} - -#title { - text-transform: capitalize; -} - -.line{display:block;clear:both; width:100%; margin:0;padding:0; float:left; background-color: transparent;} -.box5, .box10, .box15 .box20, .box25, .box30, .box35, .box40, .box45, .box50, .box55, .box60, .box65, .box70, .box75, .box80, .box85, .box90, .box95, .box100{position: relative;display: inline-block; box-sizing: border-box; padding: 5px 10px; -moz-box-sizing: border-box; vertical-align: top; margin:0;} -.float-right{float:right !important;} - -.box5{width:4%; min-width: 100px; float:left;} -.box10{width:9%; min-width: 100px; float:left;} -.box15{width:14%; min-width: 150px;float:left;} -.box20{width:19%; min-width: 200px;float:left;} -.box25{width:24%; min-width: 250px;float:left;} -.box30{width:29%; min-width: 300px;float:left;} -.box35{width:34%; min-width: 350px;float:left;} -.box40{width:39%; min-width: 400px;float:left;} -.box45{width:44%; min-width: 450px;float:left;} -.box50{width:49%; min-width: 500px;float:left;} -.box55{width:54%; min-width: 550px;float:left;} -.box60{width:59%; min-width: 600px;float:left;} -.box65{width:64%; min-width: 650px;float:left;} -.box70{width:69%; min-width: 700px;float:left;} -.box75{width:74%; min-width: 750px;float:left;} -.box80{width:79%; min-width: 800px;float:left;} -.box85{width:84%; min-width: 850px;float:left;} -.box90{width:89%; min-width: 900px;float:left;} -.box95{width:94%; min-width: 950px;float:left;} -.box100, .clear, .clear5, .clear10, .clear15, .clear20, .clear25{width:100%; clear: both;} -.clear{display: block;} -.clear5{height: 10px;} -.clear10{height: 20px;} -.clear15{height: 30px;} -.clear20{height: 40px;} -.clear25{height: 50px;} -.strong{text-transform: uppercase !important;} -.no-margin{margin:0 !important;} -.no-padding{padding:0 !important;} -.box-center{float: none !important; margin-left: auto !important; margin-right: auto !important;} -.txt-center{text-align: center !important;} - -p.title{font-family: 'HelveticaBd', Helvetica, Arial; font-size: 30px; color: #fff; text-shadow: 0 1px 3px #9e6ce8; text-align: right;} -p.count-examples{font-size: 12px; color: #676773; text-align: right;} - -ul.group-items{background-image: url('../../_site/images/laser1.png'); background-repeat: no-repeat; background-position: left top 5px; padding-left: 125px; width: 875px !important;} -ul.group-items > li{width: 213px; padding-top: 15px; height: 35px; background: url('../../_site/images/group-item.png') no-repeat; text-align: center; display: inline-block; margin-bottom: 15px} -ul.group-items > li a{display:block; width:100%; height: 100%; padding: 20px 0; margin-top: -20px; color:#333;} -ul.group-items > li a:hover{cursor: pointer; text-decoration: underline;} -ul.group-items > li a span.mark{display:inline-block;width: 1px; height: 25px; vertical-align: middle;} -ul.group-items > li a:visited span.mark{background: url('../../_site/images/group-item-hover.png') no-repeat; background-position: center center;width:25px; padding-left:4px;} - -.laser2{background-image: url('../../_site/images/laser2.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser3{background-image: url('../../_site/images/laser3.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser4{background-image: url('../../_site/images/laser4.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser5{background-image: url('../../_site/images/laser5.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser6{background-image: url('../../_site/images/laser6.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser7{background-image: url('../../_site/images/laser7.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser8{background-image: url('../../_site/images/laser8.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser9{background-image: url('../../_site/images/laser9.png') !important; background-repeat: no-repeat; background-position: center 20px;} -.laser10{background-image: url('../../_site/images/laser10.png') !important; background-repeat: no-repeat; background-position: center 20px;} - -.bright-bg, .dark-bg{border-bottom: 1px solid #d1d1d1; padding:25px 0;} - -.border-bottom{border-bottom: 1px solid #d1d1d1;} - -.prize-bg{background: url('../../_site/images/prize-bg.png') no-repeat; background-size: cover; background-position: center center; height: 326px; width: 100%;} -.prize-button{text-transform: uppercase; color: #000; text-shadow: 1px 0 #fff; float:right; background: url('../../_site/images/prize-button.png') no-repeat; width: 300px; height: 70px; padding-top:135px; font-size: 16px; padding-left: 75px; margin-top: 25px; margin-right: 145px;} - -.footer{ background: #e0e4f1 url('../../_site/images/footer-bg2.jpg') no-repeat; background-size: cover; width:100%; height: 592px; bottom:0; } -.photonstorm-logo{background: url('../../_site/images/photonstorm-logo.png') no-repeat; background-size: cover; display: block;clear:both; width:113px;height:15px; margin-bottom: 6px;} -.flixel-logo{display:block; clear:both; width:26px; height:50px; background: url('../../_site/images/flixel-logo.png') no-repeat;} -.forums-icon, .twitter-icon, .github-icon{background: url('../../_site/images/forums-icon.png') no-repeat; vertical-align: middle; padding-left: 68px; height: 35px; display: inline-block; padding-top: 25px;} -.twitter-icon{background: url('../../_site/images/twitter-icon.png') no-repeat;} -.github-icon{background: url('../../_site/images/github-icon.png') no-repeat;} - -#footer .main-container .line { - margin-top: 130px; - color:#fff; text-shadow: 1px 1px 0 #000; line-height: 1.25em; font-size: 15px; -} - -ul.footer-links{list-style-type: none; width:100%; clear:both; padding:0; margin:0; float:right; margin-top: -20px;} -ul.footer-links > li{display: inline-block; padding:0; margin:0; float:right;} - -.game-panel{width:800px; height: 680px; overflow: hidden; display:block; clear:both;box-shadow: 0 0 15px #6ac8f8; margin:-150px auto 0 auto; border-radius: 10px; position: relative; z-index: 10;} -.game-screen{display:block; clear:both; width:800px;height:600px;margin:0;} -.game-controls{display:block; width:100%; height:80px; margin:0; padding:0;background: url('../../_site/images/game-controls-bg.jpg') repeat-x;} -ul.left-controls{float:left; list-style-type: none; margin:30px 0 0 25px;padding:0; display: inline-block;} -ul.left-controls > li{margin:0;padding:0; display: inline-block; vertical-align: middle;} -.controls-label{display:inline-block; width:80px; height:9px; background: url('../../_site/images/controls-label.png') no-repeat;} -.up-label{display: inline-block; width:11px; height: 11px; background: url('../../_site/images/up-label.png') no-repeat;} -.down-label{display: inline-block; width:11px; height: 11px; background: url('../../_site/images/down-label.png') no-repeat;} -.left-label{display: inline-block; width:13px; height: 11px; background: url('../../_site/images/left-label.png') no-repeat;} -.right-label{display: inline-block; width:12px; height: 11px; background: url('../../_site/images/right-label.png') no-repeat;} -.space-label{display: inline-block; width:64px; height: 18px; background: url('../../_site/images/space-label.png') no-repeat;} - -ul.right-controls{float:right;list-style-type: none; padding:0; display: inline-block; margin: 15px 25px 0 0;} -ul.right-controls > li{margin:0;padding:0; display: inline-block; vertical-align: middle;} -.pause-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/pause-button.png') no-repeat;} -.mute-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/mute-button.png') no-repeat;} -.reset-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/reset-button.png') no-repeat;} -.pause-button:hover, .mute-button:hover, .reset-button:hover{cursor: pointer;} -.filler{height: 720px;} -.code-block{font-family: Courier; font-size: 12px; color: #fff; width:750px; height:auto; overflow: scroll; margin:0 auto; border-radius: 10px; background:#fdfdfd; border:0 !important; box-shadow: inset 0 5px 15px rgba(0,0,0,0.15), 0 0 10px rgba(106,200,248,0.5); padding: 25px !important;display: block; margin-bottom: 20px; margin-top: 30px;} -.px800{width:800px; clear:both; display: block; margin:0 auto; line-height: 1.5em;} -.gradient p{color:#333;} - -@media only screen and (max-width: 1235px), only screen and (max-device-width: 1235px){ - ul.nav-links{min-width:100% !important;} - ul.nav-links > li{display: inline-block;} -} -@media only screen and (max-width: 1120px), only screen and (max-device-width: 1120px){ - .footer .box20, .footer .box55, .footer .box15{display: block; clear:both; margin:10px auto; text-align: center; float:none;} - .footer .box5{display:none;} - .photonstorm-logo{margin:10px auto;} - .footer .box55{width:100%; float:none; margin:10px auto;} - .footer ul.footer-links{width:100%;} - .footer ul.footer-links > li{float:none;} - .footer > .main-container > .line{margin-top: 125px;} -} -@media only screen and (max-width: 1020px), only screen and (max-device-width: 1020px){ - .phaser-logo{display:none;} - .header{margin-bottom: -350px;} - p.title, p.count-examples{text-align: center;} - .box20, .box60{min-width:100% !important; clear:both; width: 100% !important; max-width: 100% !important; text-align: center;} - a.prize-button{margin:0 auto; float:none;display:block;} - .prize-bg{background: transparent;} -} -@media only screen and (max-width: 810px), only screen and (max-device-width: 810px){ - .main-container{width:100%;} -} \ No newline at end of file diff --git a/examples/_site/css/phaser-lite.css b/examples/_site/css/phaser-lite.css deleted file mode 100644 index ce1d4bdf6..000000000 --- a/examples/_site/css/phaser-lite.css +++ /dev/null @@ -1,84 +0,0 @@ -@font-face { - - font-family: 'inconsolata'; - src: url('../../_site/fonts/inconsolata.woff') format('woff'); - font-weight: normal; - font-style: normal; - -} - -body { - - background: #e0e4f1; - margin: 0px; - font-family: 'inconsolata'; - font-size: 15px; - overflow: hidden; - -} - -a { - text-decoration: none; - color: #1c99bb; -} - -a:hover { - background-color: #e69b0b; - color: #fff; -} - -h1 { - - font-size: 25px; - font-weight: normal; - -} - -h2 { - - font-size: 20px; - font-weight: normal; - -} - -#header { - background: url(../../_site/images/lite_header.jpg) no-repeat left top; - width: 300px; - height: 100px; -} - -#panel { - - background: url(../../_site/images/lite_header_2.jpg) no-repeat left top; - width: 300px; - overflow-x: hidden; - overflow-y: scroll; - -} - - #panel #examples-list { - - padding: 10px 20px; - line-height: 18px; - - } - -#footer { - background: url(../../_site/images/lite_footer.jpg) no-repeat left top; - width: 300px; - height: 170px; - color: #000; - text-align: center; -} - -#viewer { - - position: absolute; - top: 0px; - left: 300px; - width: -webkit-calc(100% - 300px); /* Safari */ - width: calc(100% - 300px); - height: 100%; - border: 0px; - -} diff --git a/examples/_site/examples.json b/examples/_site/examples.json deleted file mode 100644 index 107a8f32a..000000000 --- a/examples/_site/examples.json +++ /dev/null @@ -1,1068 +0,0 @@ -{ - "animation": [ - { - "file": "animation+events.js", - "title": "animation events" - }, - { - "file": "change+texture+on+click.js", - "title": "change texture on click" - }, - { - "file": "group+creation.js", - "title": "group creation" - }, - { - "file": "local+json+object.js", - "title": "local json object" - }, - { - "file": "looped+animation.js", - "title": "looped animation" - }, - { - "file": "multiple+anims.js", - "title": "multiple anims" - }, - { - "file": "sprite+sheet.js", - "title": "sprite sheet" - }, - { - "file": "starling+atlas.js", - "title": "starling atlas" - } - ], - "arcade physics": [ - { - "file": "accelerate+to+pointer.js", - "title": "accelerate to pointer" - }, - { - "file": "angle+between.js", - "title": "angle between" - }, - { - "file": "angle+to+pointer.js", - "title": "angle to pointer" - }, - { - "file": "angular+acceleration.js", - "title": "angular acceleration" - }, - { - "file": "angular+velocity.js", - "title": "angular velocity" - }, - { - "file": "body+scale.js", - "title": "body scale" - }, - { - "file": "bounce+accelerator.js", - "title": "bounce accelerator" - }, - { - "file": "bounce+knock.js", - "title": "bounce knock" - }, - { - "file": "bounce+with+gravity.js", - "title": "bounce with gravity" - }, - { - "file": "bounce.js", - "title": "bounce" - }, - { - "file": "bounding+box.js", - "title": "bounding box" - }, - { - "file": "gravity.js", - "title": "gravity" - }, - { - "file": "group+vs+group.js", - "title": "group vs group" - }, - { - "file": "group+vs+self.js", - "title": "group vs self" - }, - { - "file": "larger+bounding+box.js", - "title": "larger bounding box" - }, - { - "file": "launcher+follow+world.js", - "title": "launcher follow world" - }, - { - "file": "launcher+follow.js", - "title": "launcher follow" - }, - { - "file": "launcher.js", - "title": "launcher" - }, - { - "file": "mass+velocity+test.js", - "title": "mass velocity test" - }, - { - "file": "move+towards+object.js", - "title": "move towards object" - }, - { - "file": "multi+angle+to+pointer.js", - "title": "multi angle to pointer" - }, - { - "file": "offset+bounding+box.js", - "title": "offset bounding box" - }, - { - "file": "one+way+collision.js", - "title": "one way collision" - }, - { - "file": "process+callback.js", - "title": "process callback" - }, - { - "file": "quadtree+-+collision+infos.js", - "title": "quadtree - collision infos" - }, - { - "file": "ship+trail.js", - "title": "ship trail" - }, - { - "file": "shoot+the+pointer.js", - "title": "shoot the pointer" - }, - { - "file": "snake.js", - "title": "snake" - }, - { - "file": "sprite+vs+group.js", - "title": "sprite vs group" - }, - { - "file": "sprite+vs+sprite.js", - "title": "sprite vs sprite" - }, - { - "file": "vertical+collision.js", - "title": "vertical collision" - } - ], - "audio": [ - { - "file": "loop.js", - "title": "loop" - }, - { - "file": "pause+and+resume.js", - "title": "pause and resume" - }, - { - "file": "play+music.js", - "title": "play music" - }, - { - "file": "protracker.js", - "title": "protracker" - } - ], - "basics": [ - { - "file": "01+-+load+an+image.js", - "title": "01 - load an image" - }, - { - "file": "02+-+click+on+an+image.js", - "title": "02 - click on an image" - }, - { - "file": "03+-+move+an+image.js", - "title": "03 - move an image" - }, - { - "file": "04+-+image+follow+input.js", - "title": "04 - image follow input" - }, - { - "file": "05+-+load+an+animation.js", - "title": "05 - load an animation" - }, - { - "file": "06+-+render+text.js", - "title": "06 - render text" - } - ], - "buttons": [ - { - "file": "action+on+click.js", - "title": "action on click" - }, - { - "file": "button+scale.js", - "title": "button scale" - }, - { - "file": "changing+the+frames.js", - "title": "changing the frames" - }, - { - "file": "rotated+buttons.js", - "title": "rotated buttons" - } - ], - "camera": [ - { - "file": "basic+follow.js", - "title": "basic follow" - }, - { - "file": "camera+cull.js", - "title": "camera cull" - }, - { - "file": "follow+styles.js", - "title": "follow styles" - }, - { - "file": "moving+the+camera.js", - "title": "moving the camera" - }, - { - "file": "world+sprite.js", - "title": "world sprite" - } - ], - "debug": [ - { - "file": "debug+camera.js", - "title": "debug camera" - }, - { - "file": "debug+display.js", - "title": "debug display" - }, - { - "file": "debug+draw.js", - "title": "debug draw" - }, - { - "file": "debug+input.js", - "title": "debug input" - }, - { - "file": "debug+physics.js", - "title": "debug physics" - }, - { - "file": "debug+sprite.js", - "title": "debug sprite" - } - ], - "display": [ - { - "file": "bitmapdata+wobble.js", - "title": "bitmapdata wobble" - }, - { - "file": "fullscreen+buttons.js", - "title": "fullscreen buttons" - }, - { - "file": "fullscreen.js", - "title": "fullscreen" - }, - { - "file": "graphics.js", - "title": "graphics" - }, - { - "file": "pixi+render+texture.js", - "title": "pixi render texture" - }, - { - "file": "render+crisp.js", - "title": "render crisp" - }, - { - "file": "render+texture+mirror.js", - "title": "render texture mirror" - }, - { - "file": "render+texture+starfield.js", - "title": "render texture starfield" - }, - { - "file": "render+texture+trail.js", - "title": "render texture trail" - } - ], - "filters": [ - { - "file": "blur.js", - "title": "blur" - }, - { - "file": "checker+wave.js", - "title": "checker wave" - }, - { - "file": "fire.js", - "title": "fire" - }, - { - "file": "gray.js", - "title": "gray" - }, - { - "file": "lightbeams.js", - "title": "lightbeams" - }, - { - "file": "marble.js", - "title": "marble" - }, - { - "file": "plasma.js", - "title": "plasma" - }, - { - "file": "tunnel.js", - "title": "tunnel" - } - ], - "games": [ - { - "file": "breakout.js", - "title": "breakout" - }, - { - "file": "invaders.js", - "title": "invaders" - }, - { - "file": "matching+pairs.js", - "title": "matching pairs" - }, - { - "file": "simon.js", - "title": "simon" - }, - { - "file": "starstruck.js", - "title": "starstruck" - }, - { - "file": "tanks.js", - "title": "tanks" - } - ], - "geometry": [ - { - "file": "circle.js", - "title": "circle" - }, - { - "file": "line+bounds.js", - "title": "line bounds" - }, - { - "file": "line+intersection.js", - "title": "line intersection" - }, - { - "file": "line.js", - "title": "line" - }, - { - "file": "playing+with+points.js", - "title": "playing with points" - }, - { - "file": "rectangle.js", - "title": "rectangle" - }, - { - "file": "rotate+point.js", - "title": "rotate point" - } - ], - "groups": [ - { - "file": "add+a+sprite+to+group.js", - "title": "add a sprite to group" - }, - { - "file": "bring+a+group+to+top.js", - "title": "bring a group to top" - }, - { - "file": "call+all+animations.js", - "title": "call all animations" - }, - { - "file": "call+all.js", - "title": "call all" - }, - { - "file": "create+group.js", - "title": "create group" - }, - { - "file": "create+sprite+in+a+group.js", - "title": "create sprite in a group" - }, - { - "file": "depth+sort.js", - "title": "depth sort" - }, - { - "file": "display+order.js", - "title": "display order" - }, - { - "file": "extending+a+group.js", - "title": "extending a group" - }, - { - "file": "for+each.js", - "title": "for each" - }, - { - "file": "get+first+dead.js", - "title": "get first dead" - }, - { - "file": "get+first.js", - "title": "get first" - }, - { - "file": "group+as+layer.js", - "title": "group as layer" - }, - { - "file": "group+transform+-+rotate.js", - "title": "group transform - rotate" - }, - { - "file": "group+transform+-+tween.js", - "title": "group transform - tween" - }, - { - "file": "group+transform.js", - "title": "group transform" - }, - { - "file": "nested+groups.js", - "title": "nested groups" - }, - { - "file": "recyling.js", - "title": "recyling" - }, - { - "file": "remove.js", - "title": "remove" - }, - { - "file": "replace.js", - "title": "replace" - }, - { - "file": "set+All.js", - "title": "set All" - }, - { - "file": "sub+groups+-+group+length.js", - "title": "sub groups - group length" - }, - { - "file": "swap+children+in+a+group.js", - "title": "swap children in a group" - } - ], - "input": [ - { - "file": "bring+a+child+to+top.js", - "title": "bring a child to top" - }, - { - "file": "cursor+key+movement.js", - "title": "cursor key movement" - }, - { - "file": "drag+several+sprites.js", - "title": "drag several sprites" - }, - { - "file": "drag.js", - "title": "drag" - }, - { - "file": "drop+limitation.js", - "title": "drop limitation" - }, - { - "file": "follow+mouse.js", - "title": "follow mouse" - }, - { - "file": "game+scale.js", - "title": "game scale" - }, - { - "file": "gamepad+analog+button.js", - "title": "gamepad analog button" - }, - { - "file": "gamepad+debug.js", - "title": "gamepad debug" - }, - { - "file": "gamepad+hotkeys.js", - "title": "gamepad hotkeys" - }, - { - "file": "gamepad+multiple+pads.js", - "title": "gamepad multiple pads" - }, - { - "file": "gamepad+tanks.js", - "title": "gamepad tanks" - }, - { - "file": "gamepad.js", - "title": "gamepad" - }, - { - "file": "key.js", - "title": "key" - }, - { - "file": "keyboard+hotkeys.js", - "title": "keyboard hotkeys" - }, - { - "file": "keyboard+justpressed.js", - "title": "keyboard justpressed" - }, - { - "file": "keyboard.js", - "title": "keyboard" - }, - { - "file": "motion+lock+-+horizontal.js", - "title": "motion lock - horizontal" - }, - { - "file": "motion+lock+-+vertical.js", - "title": "motion lock - vertical" - }, - { - "file": "multi+touch.js", - "title": "multi touch" - }, - { - "file": "override+default+controls.js", - "title": "override default controls" - }, - { - "file": "pixel+perfect+click+detection.js", - "title": "pixel perfect click detection" - }, - { - "file": "pixelpick+-+atlas.js", - "title": "pixelpick - atlas" - }, - { - "file": "pixelpick+-+scrolling+effect.js", - "title": "pixelpick - scrolling effect" - }, - { - "file": "pixelpick+-+spritesheet.js", - "title": "pixelpick - spritesheet" - }, - { - "file": "snap+on+drag.js", - "title": "snap on drag" - }, - { - "file": "touch+joystick.js", - "title": "touch joystick" - } - ], - "loader": [ - { - "file": "load+audio.js", - "title": "load audio" - }, - { - "file": "load+bitmap+font.js", - "title": "load bitmap font" - }, - { - "file": "load+image.js", - "title": "load image" - }, - { - "file": "load+spritesheet.js", - "title": "load spritesheet" - }, - { - "file": "load+starling+atlas.js", - "title": "load starling atlas" - }, - { - "file": "load+text+file.js", - "title": "load text file" - }, - { - "file": "load+texture+atlas.js", - "title": "load texture atlas" - }, - { - "file": "load+tilemap+json.js", - "title": "load tilemap json" - }, - { - "file": "pick+images+from+cache.js", - "title": "pick images from cache" - } - ], - "misc": [ - { - "file": "net.js", - "title": "net" - }, - { - "file": "random+generators.js", - "title": "random generators" - }, - { - "file": "repeatable+random+numbers.js", - "title": "repeatable random numbers" - } - ], - "ninja physics": [ - { - "file": "ninja+aabb+vs+aabb.js", - "title": "ninja aabb vs aabb" - }, - { - "file": "ninja+aabb+vs+tile.js", - "title": "ninja aabb vs tile" - }, - { - "file": "ninja+impact.js", - "title": "ninja impact" - }, - { - "file": "ninja+tilemap.js", - "title": "ninja tilemap" - } - ], - "p2 physics": [ - { - "file": "basic+movement.js", - "title": "basic movement" - }, - { - "file": "body+click.js", - "title": "body click" - }, - { - "file": "collision+groups.js", - "title": "collision groups" - }, - { - "file": "contact+events.js", - "title": "contact events" - }, - { - "file": "distance+constraint.js", - "title": "distance constraint" - }, - { - "file": "gear+constraint.js", - "title": "gear constraint" - }, - { - "file": "gravity.js", - "title": "gravity" - }, - { - "file": "impact+events.js", - "title": "impact events" - }, - { - "file": "kill+and+revive.js", - "title": "kill and revive" - }, - { - "file": "load+polygon+1.js", - "title": "load polygon 1" - }, - { - "file": "load+polygon+2.js", - "title": "load polygon 2" - }, - { - "file": "lock+constraint.js", - "title": "lock constraint" - }, - { - "file": "postbroadphase+callback.js", - "title": "postbroadphase callback" - }, - { - "file": "prismatic+constraint.js", - "title": "prismatic constraint" - }, - { - "file": "revolute+constraint.js", - "title": "revolute constraint" - }, - { - "file": "springs.js", - "title": "springs" - }, - { - "file": "thrust.js", - "title": "thrust" - }, - { - "file": "world+move.js", - "title": "world move" - } - ], - "particles": [ - { - "file": "click+burst.js", - "title": "click burst" - }, - { - "file": "collision.js", - "title": "collision" - }, - { - "file": "diamond+burst.js", - "title": "diamond burst" - }, - { - "file": "no+rotation.js", - "title": "no rotation" - }, - { - "file": "rain.js", - "title": "rain" - }, - { - "file": "random+sprite.js", - "title": "random sprite" - }, - { - "file": "snow.js", - "title": "snow" - }, - { - "file": "when+particles+collide.js", - "title": "when particles collide" - }, - { - "file": "zero+gravity.js", - "title": "zero gravity" - } - ], - "sprites": [ - { - "file": "add+a+sprite.js", - "title": "add a sprite" - }, - { - "file": "add+several+sprites.js", - "title": "add several sprites" - }, - { - "file": "collide+world+bounds.js", - "title": "collide world bounds" - }, - { - "file": "destroy.js", - "title": "destroy" - }, - { - "file": "dynamic+crop.js", - "title": "dynamic crop" - }, - { - "file": "extending+sprite+demo+1.js", - "title": "extending sprite demo 1" - }, - { - "file": "extending+sprite+demo+2.js", - "title": "extending sprite demo 2" - }, - { - "file": "horizontal+crop.js", - "title": "horizontal crop" - }, - { - "file": "move+a+sprite.js", - "title": "move a sprite" - }, - { - "file": "out+of+bounds.js", - "title": "out of bounds" - }, - { - "file": "scale+a+sprite.js", - "title": "scale a sprite" - }, - { - "file": "shared+sprite+textures.js", - "title": "shared sprite textures" - }, - { - "file": "sprite+rotation.js", - "title": "sprite rotation" - }, - { - "file": "spritesheet.js", - "title": "spritesheet" - }, - { - "file": "vertical+crop.js", - "title": "vertical crop" - } - ], - "text": [ - { - "file": "bitmap+fonts.js", - "title": "bitmap fonts" - }, - { - "file": "bitmapfont+drag.js", - "title": "bitmapfont drag" - }, - { - "file": "dynamic+text+shadow.js", - "title": "dynamic text shadow" - }, - { - "file": "google+webfonts.js", - "title": "google webfonts" - }, - { - "file": "hello+arial.js", - "title": "hello arial" - }, - { - "file": "kern+of+duty.js", - "title": "kern of duty" - }, - { - "file": "littera.js", - "title": "littera" - }, - { - "file": "remove+text.js", - "title": "remove text" - }, - { - "file": "retro+font+1.js", - "title": "retro font 1" - }, - { - "file": "retro+font+2.js", - "title": "retro font 2" - }, - { - "file": "set+properties+after+creation.js", - "title": "set properties after creation" - }, - { - "file": "text+gradient.js", - "title": "text gradient" - }, - { - "file": "text+reflect.js", - "title": "text reflect" - }, - { - "file": "text+shadow.js", - "title": "text shadow" - }, - { - "file": "text+stroke.js", - "title": "text stroke" - }, - { - "file": "update+text.js", - "title": "update text" - } - ], - "tile sprites": [ - { - "file": "animated+tiling+sprite.js", - "title": "animated tiling sprite" - }, - { - "file": "colliding+with+tiling+sprite.js", - "title": "colliding with tiling sprite" - }, - { - "file": "tiling+sprite.js", - "title": "tiling sprite" - } - ], - "tilemaps": [ - { - "file": "blank+tilemap.js", - "title": "blank tilemap" - }, - { - "file": "create+from+objects.js", - "title": "create from objects" - }, - { - "file": "csv+map.js", - "title": "csv map" - }, - { - "file": "fill+tiles.js", - "title": "fill tiles" - }, - { - "file": "map+bounce.js", - "title": "map bounce" - }, - { - "file": "map+collide.js", - "title": "map collide" - }, - { - "file": "paint+tiles.js", - "title": "paint tiles" - }, - { - "file": "randomise+tiles.js", - "title": "randomise tiles" - }, - { - "file": "replace+tiles.js", - "title": "replace tiles" - }, - { - "file": "sci+fly.js", - "title": "sci fly" - }, - { - "file": "shuffle+tiles.js", - "title": "shuffle tiles" - }, - { - "file": "swap+tiles.js", - "title": "swap tiles" - }, - { - "file": "tile+callbacks.js", - "title": "tile callbacks" - }, - { - "file": "tilemap+ray+cast.js", - "title": "tilemap ray cast" - } - ], - "time": [ - { - "file": "basic+looped+event.js", - "title": "basic looped event" - }, - { - "file": "basic+repeat+event.js", - "title": "basic repeat event" - }, - { - "file": "basic+timed+event.js", - "title": "basic timed event" - }, - { - "file": "remove+event.js", - "title": "remove event" - }, - { - "file": "timed+slideshow.js", - "title": "timed slideshow" - } - ], - "tweens": [ - { - "file": "bounce.js", - "title": "bounce" - }, - { - "file": "bubbles.js", - "title": "bubbles" - }, - { - "file": "chained+tweens.js", - "title": "chained tweens" - }, - { - "file": "combined+tweens.js", - "title": "combined tweens" - }, - { - "file": "easing+spritesheets.js", - "title": "easing spritesheets" - }, - { - "file": "easing.js", - "title": "easing" - }, - { - "file": "fading+in+a+sprite.js", - "title": "fading in a sprite" - }, - { - "file": "generate+data.js", - "title": "generate data" - }, - { - "file": "pause+tween.js", - "title": "pause tween" - }, - { - "file": "tween+loop+event.js", - "title": "tween loop event" - }, - { - "file": "tween+relative.js", - "title": "tween relative" - }, - { - "file": "tween+several+properties.js", - "title": "tween several properties" - } - ], - "world": [ - { - "file": "fixed+to+camera.js", - "title": "fixed to camera" - }, - { - "file": "move+around+world.js", - "title": "move around world" - } - ] -} \ No newline at end of file diff --git a/examples/_site/fonts/HelveticaNeueLTStd-Bd.otf b/examples/_site/fonts/HelveticaNeueLTStd-Bd.otf deleted file mode 100644 index d4ac7c110..000000000 Binary files a/examples/_site/fonts/HelveticaNeueLTStd-Bd.otf and /dev/null differ diff --git a/examples/_site/fonts/inconsolata.woff b/examples/_site/fonts/inconsolata.woff deleted file mode 100644 index 6170a0bfc..000000000 Binary files a/examples/_site/fonts/inconsolata.woff and /dev/null differ diff --git a/examples/_site/images/bg-footer.jpg b/examples/_site/images/bg-footer.jpg deleted file mode 100644 index 5189cb55d..000000000 Binary files a/examples/_site/images/bg-footer.jpg and /dev/null differ diff --git a/examples/_site/images/controls-label.png b/examples/_site/images/controls-label.png deleted file mode 100644 index 384c986cc..000000000 Binary files a/examples/_site/images/controls-label.png and /dev/null differ diff --git a/examples/_site/images/down-label.png b/examples/_site/images/down-label.png deleted file mode 100644 index 0039d57b4..000000000 Binary files a/examples/_site/images/down-label.png and /dev/null differ diff --git a/examples/_site/images/flixel-logo.png b/examples/_site/images/flixel-logo.png deleted file mode 100644 index cb50f865f..000000000 Binary files a/examples/_site/images/flixel-logo.png and /dev/null differ diff --git a/examples/_site/images/footer-bg.jpg b/examples/_site/images/footer-bg.jpg deleted file mode 100644 index ba8c17ae2..000000000 Binary files a/examples/_site/images/footer-bg.jpg and /dev/null differ diff --git a/examples/_site/images/footer-bg2.jpg b/examples/_site/images/footer-bg2.jpg deleted file mode 100644 index 4811c4508..000000000 Binary files a/examples/_site/images/footer-bg2.jpg and /dev/null differ diff --git a/examples/_site/images/forums-icon.png b/examples/_site/images/forums-icon.png deleted file mode 100644 index 79c1c8b1a..000000000 Binary files a/examples/_site/images/forums-icon.png and /dev/null differ diff --git a/examples/_site/images/game-controls-bg.jpg b/examples/_site/images/game-controls-bg.jpg deleted file mode 100644 index 82e40bf83..000000000 Binary files a/examples/_site/images/game-controls-bg.jpg and /dev/null differ diff --git a/examples/_site/images/github-icon.png b/examples/_site/images/github-icon.png deleted file mode 100644 index e04eb798e..000000000 Binary files a/examples/_site/images/github-icon.png and /dev/null differ diff --git a/examples/_site/images/gradient-bg.jpg b/examples/_site/images/gradient-bg.jpg deleted file mode 100644 index 0669f1040..000000000 Binary files a/examples/_site/images/gradient-bg.jpg and /dev/null differ diff --git a/examples/_site/images/group-item-hover.png b/examples/_site/images/group-item-hover.png deleted file mode 100644 index bf0fc009d..000000000 Binary files a/examples/_site/images/group-item-hover.png and /dev/null differ diff --git a/examples/_site/images/group-item.png b/examples/_site/images/group-item.png deleted file mode 100644 index 9638cad4b..000000000 Binary files a/examples/_site/images/group-item.png and /dev/null differ diff --git a/examples/_site/images/header-bg.jpg b/examples/_site/images/header-bg.jpg deleted file mode 100644 index b5cafc40a..000000000 Binary files a/examples/_site/images/header-bg.jpg and /dev/null differ diff --git a/examples/_site/images/header-bg2.jpg b/examples/_site/images/header-bg2.jpg deleted file mode 100644 index 5dcabec26..000000000 Binary files a/examples/_site/images/header-bg2.jpg and /dev/null differ diff --git a/examples/_site/images/laser1.png b/examples/_site/images/laser1.png deleted file mode 100644 index 4c23aa167..000000000 Binary files a/examples/_site/images/laser1.png and /dev/null differ diff --git a/examples/_site/images/laser10.png b/examples/_site/images/laser10.png deleted file mode 100644 index bf1cc4404..000000000 Binary files a/examples/_site/images/laser10.png and /dev/null differ diff --git a/examples/_site/images/laser2.png b/examples/_site/images/laser2.png deleted file mode 100644 index 61d630837..000000000 Binary files a/examples/_site/images/laser2.png and /dev/null differ diff --git a/examples/_site/images/laser3.png b/examples/_site/images/laser3.png deleted file mode 100644 index 90a74a011..000000000 Binary files a/examples/_site/images/laser3.png and /dev/null differ diff --git a/examples/_site/images/laser4.png b/examples/_site/images/laser4.png deleted file mode 100644 index 2e99d190f..000000000 Binary files a/examples/_site/images/laser4.png and /dev/null differ diff --git a/examples/_site/images/laser5.png b/examples/_site/images/laser5.png deleted file mode 100644 index ee8c3b7e6..000000000 Binary files a/examples/_site/images/laser5.png and /dev/null differ diff --git a/examples/_site/images/laser6.png b/examples/_site/images/laser6.png deleted file mode 100644 index 5bb2d5d58..000000000 Binary files a/examples/_site/images/laser6.png and /dev/null differ diff --git a/examples/_site/images/laser7.png b/examples/_site/images/laser7.png deleted file mode 100644 index d96a5ad90..000000000 Binary files a/examples/_site/images/laser7.png and /dev/null differ diff --git a/examples/_site/images/laser8.png b/examples/_site/images/laser8.png deleted file mode 100644 index 5d086fa1e..000000000 Binary files a/examples/_site/images/laser8.png and /dev/null differ diff --git a/examples/_site/images/laser9.png b/examples/_site/images/laser9.png deleted file mode 100644 index d735325a6..000000000 Binary files a/examples/_site/images/laser9.png and /dev/null differ diff --git a/examples/_site/images/left-label.png b/examples/_site/images/left-label.png deleted file mode 100644 index 8f796dda4..000000000 Binary files a/examples/_site/images/left-label.png and /dev/null differ diff --git a/examples/_site/images/lite_footer.jpg b/examples/_site/images/lite_footer.jpg deleted file mode 100644 index 51549193a..000000000 Binary files a/examples/_site/images/lite_footer.jpg and /dev/null differ diff --git a/examples/_site/images/lite_header.jpg b/examples/_site/images/lite_header.jpg deleted file mode 100644 index 0aa2e2fc3..000000000 Binary files a/examples/_site/images/lite_header.jpg and /dev/null differ diff --git a/examples/_site/images/lite_header_2.jpg b/examples/_site/images/lite_header_2.jpg deleted file mode 100644 index fa1eb718a..000000000 Binary files a/examples/_site/images/lite_header_2.jpg and /dev/null differ diff --git a/examples/_site/images/mute-button.png b/examples/_site/images/mute-button.png deleted file mode 100644 index dccd26af6..000000000 Binary files a/examples/_site/images/mute-button.png and /dev/null differ diff --git a/examples/_site/images/nav-icons.png b/examples/_site/images/nav-icons.png deleted file mode 100644 index faf9201e0..000000000 Binary files a/examples/_site/images/nav-icons.png and /dev/null differ diff --git a/examples/_site/images/pause-button.png b/examples/_site/images/pause-button.png deleted file mode 100644 index c5bcfd387..000000000 Binary files a/examples/_site/images/pause-button.png and /dev/null differ diff --git a/examples/_site/images/phaser-examples.png b/examples/_site/images/phaser-examples.png deleted file mode 100644 index 8900dba6d..000000000 Binary files a/examples/_site/images/phaser-examples.png and /dev/null differ diff --git a/examples/_site/images/phaser-logo.png b/examples/_site/images/phaser-logo.png deleted file mode 100644 index 3a72d92e8..000000000 Binary files a/examples/_site/images/phaser-logo.png and /dev/null differ diff --git a/examples/_site/images/phaser-version.png b/examples/_site/images/phaser-version.png deleted file mode 100644 index 5839174bf..000000000 Binary files a/examples/_site/images/phaser-version.png and /dev/null differ diff --git a/examples/_site/images/photonstorm-logo.png b/examples/_site/images/photonstorm-logo.png deleted file mode 100644 index 75ae525bf..000000000 Binary files a/examples/_site/images/photonstorm-logo.png and /dev/null differ diff --git a/examples/_site/images/prize-bg.png b/examples/_site/images/prize-bg.png deleted file mode 100644 index f6215e7d7..000000000 Binary files a/examples/_site/images/prize-bg.png and /dev/null differ diff --git a/examples/_site/images/prize-button.png b/examples/_site/images/prize-button.png deleted file mode 100644 index b70eaec3b..000000000 Binary files a/examples/_site/images/prize-button.png and /dev/null differ diff --git a/examples/_site/images/reset-button.png b/examples/_site/images/reset-button.png deleted file mode 100644 index 54f821da4..000000000 Binary files a/examples/_site/images/reset-button.png and /dev/null differ diff --git a/examples/_site/images/right-label.png b/examples/_site/images/right-label.png deleted file mode 100644 index 1163d1970..000000000 Binary files a/examples/_site/images/right-label.png and /dev/null differ diff --git a/examples/_site/images/space-label.png b/examples/_site/images/space-label.png deleted file mode 100644 index 073632ec9..000000000 Binary files a/examples/_site/images/space-label.png and /dev/null differ diff --git a/examples/_site/images/twitter-icon.png b/examples/_site/images/twitter-icon.png deleted file mode 100644 index 3d7a57c3b..000000000 Binary files a/examples/_site/images/twitter-icon.png and /dev/null differ diff --git a/examples/_site/images/up-label.png b/examples/_site/images/up-label.png deleted file mode 100644 index 1df6f0424..000000000 Binary files a/examples/_site/images/up-label.png and /dev/null differ diff --git a/examples/_site/images/version-button.png b/examples/_site/images/version-button.png deleted file mode 100644 index 4017049a5..000000000 Binary files a/examples/_site/images/version-button.png and /dev/null differ diff --git a/examples/_site/js/gamecontroller.js b/examples/_site/js/gamecontroller.js deleted file mode 100644 index 71efec2c6..000000000 --- a/examples/_site/js/gamecontroller.js +++ /dev/null @@ -1,1315 +0,0 @@ -/* HTML5 Virtual Game Controller - * Courtesy of Austin Hallock - * https://github.com/austinhallock/html5-virtual-game-controller/ - * Copyright (c) 2013 Clay.io - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * Helpers - */ -( function(exports) { - var __slice = [].slice; - var __hasProp = {}.hasOwnProperty; - var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - /* $.extend functionality */ - function extend( target, src ) - { - var options, name, copy, copyIsArray, clone, - i = 1, - length = 2, - deep = true; - - // Handle a deep copy situation - if( typeof target === "boolean" ) - { - deep = target; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something( possible in deep copy ) - if( typeof target !== "object" && !typeof target === 'function' ) - { - target = {}; - } - // Only deal with non-null/undefined values - if( options = src ) - { - // Extend the base object - for( name in options ) - { - src = target[name]; - copy = options[name]; - - // Prevent never-ending loop - if( target === copy ) - { - continue; - } - // Recurse if we're merging plain objects or arrays - if( deep &&( typeof copy == 'object' ||( copyIsArray = Object.prototype.toString.call( copy ) === '[object Array]' ) ) ) - { - if( copyIsArray ) - { - copyIsArray = false; - clone = src && Object.prototype.toString.call( src ) === '[object Array]' ? src : []; - - } - else - { - clone = src && typeof src == 'object' ? src : {}; - } - // Never move original objects, clone them - target[name] = extend( clone, copy ); - - // Don't bring in undefined values - } - else if( typeof copy !== 'undefined' ) - { - target[name] = copy; - } - } - } - return target; - } - - // Make available to window - exports.GameController = { - - // Default options, - options: { - left: { - type: 'dpad', - position: { left: '13%', bottom: '22%' }, - dpad: { - up: { - width: '7%', - height: '15%', - stroke: 2, - touchStart: function() { - GameController.simulateKeyEvent( 'press', 38 ); - GameController.simulateKeyEvent( 'down', 38 ); - }, - touchEnd: function() { - GameController.simulateKeyEvent( 'up', 38 ); - } - }, - left: { - width: '15%', - height: '7%', - stroke: 2, - touchStart: function() { - GameController.simulateKeyEvent( 'press', 37 ); - GameController.simulateKeyEvent( 'down', 37 ); - }, - touchEnd: function() { - GameController.simulateKeyEvent( 'up', 37 ); - } - }, - down: { - width: '7%', - height: '15%', - stroke: 2, - touchStart: function() { - GameController.simulateKeyEvent( 'press', 40 ); - GameController.simulateKeyEvent( 'down', 40 ); - }, - touchEnd: function() { - GameController.simulateKeyEvent( 'up', 40 ); - } - }, - right: { - width: '15%', - height: '7%', - stroke: 2, - touchStart: function() { - GameController.simulateKeyEvent( 'press', 39 ); - GameController.simulateKeyEvent( 'down', 39 ); - }, - touchEnd: function() { - GameController.simulateKeyEvent( 'up', 39 ); - } - } - }, - joystick: { - radius: 60, - touchMove: function( e ) { - console.log( e ); - } - } - }, - right: { - type: 'buttons', - position: { right: '17%', bottom: '28%' }, - buttons: [ - { offset: { x: '-13%', y: 0 }, label: 'X', radius: '7%', stroke: 2, backgroundColor: 'blue', fontColor: '#fff', touchStart: function() { - // Blue is currently mapped to up button - GameController.simulateKeyEvent( 'press', 88 ); // x key - GameController.simulateKeyEvent( 'down', 88 ); - }, touchEnd: function() { - GameController.simulateKeyEvent( 'up', 88 ); - } }, - { offset: { x: 0, y: '-11%' }, label: 'Y', radius: '7%', stroke: 2, backgroundColor: 'yellow', fontColor: '#fff', touchStart: function() { - GameController.simulateKeyEvent( 'press', 70 ); // f key - GameController.simulateKeyEvent( 'down', 70 ); - }, touchEnd: function() { - GameController.simulateKeyEvent( 'up', 70 ); - } }, - { offset: { x: '13%', y: 0 }, label: 'B', radius: '7%', stroke: 2, backgroundColor: 'red', fontColor: '#fff', touchStart: function() { - GameController.simulateKeyEvent( 'press', 90 ); // z key - GameController.simulateKeyEvent( 'down', 90 ); - }, touchEnd: function() { - GameController.simulateKeyEvent( 'up', 90 ); - } }, - { offset: { x: 0, y: '11%' }, label: 'A', radius: '7%', stroke: 2, backgroundColor: 'green', fontColor: '#fff', touchStart: function() { - GameController.simulateKeyEvent( 'press', 67 ); // a key - GameController.simulateKeyEvent( 'down', 67 ); - }, touchEnd: function() { - GameController.simulateKeyEvent( 'up', 67 ); - } } - ], - dpad: { - up: { - width: '7%', - height: '15%', - stroke: 2 - }, - left: { - width: '15%', - height: '7%', - stroke: 2 - }, - down: { - width: '7%', - height: '15%', - stroke: 2 - }, - right: { - width: '15%', - height: '7%', - stroke: 2 - } - }, - joystick: { - radius: 60, - touchMove: function( e ) { - console.log( e ); - } - } - }, - touchRadius: 45 - }, - - // Areas (objects) on the screen that can be touched - touchableAreas: [], - touchableAreasCount: 0, - - // Multi-touch - touches: [], - - // Canvas offset on page (for coverting touch coordinates) - offsetX: 0, - offsetY: 0, - - // Bounding box - used for clearRect - first we determine which areas of the canvas are actually drawn to - bound: { - left: false, - right: false, - top: false, - bottom: false - }, - - // Heavy sprites (with gradients) are cached as a canvas to improve performance - cachedSprites: {}, - - paused: false, - - init: function( options ) { - - // Don't do anything if there's no touch support - if( ! 'ontouchstart' in document.documentElement ) - return; - - - // Merge default options and specified options - options = options || {}; - extend( this.options, options ); - - var userAgent = navigator.userAgent.toLowerCase(); - // See if we should run the performanceFriendly version (for slower CPUs) - this.performanceFriendly = ( userAgent.indexOf( 'iphone' ) !== -1 || userAgent.indexOf( 'android' ) !== -1 || this.options.forcePerformanceFriendly ); - - // Grab the canvas if one wasn't passed - var ele; - if( !this.options.canvas || !( ele = document.getElementById( this.options.canvas ) ) ) - { - this.options.canvas = document.getElementsByTagName( 'canvas' )[0]; - } - else if( ele ) - { - this.options.canvas = ele; - } - - this.options.ctx = this.options.canvas.getContext( '2d' ); - - // Create a canvas that goes directly on top of the game canvas - this.createOverlayCanvas(); - }, - - /** - * Finds the actual 4 corners of canvas that are being used (so we don't have to clear the entire canvas each render) - * Called when each new touchableArea is added in - * @param {object} options - x, y, width, height - */ - boundingSet: function( options ) { - var directions = ['left', 'right']; - - // Square - pivot is top left - if( options.width ) - { - var width = this.getPixels( options.width ); - var height = this.getPixels( options.height ); - var left = this.getPixels( options.x ); - var top = this.getPixels( options.y ); - } - // Circle - pivot is center - else - { - if( this.options.touchRadius ) - var radius = this.getPixels( options.radius ) * 2 + ( this.getPixels( this.options.touchRadius ) / 2 ); // size of the box the joystick can go to - else - var radius = options.radius; - var width = height = ( radius + this.getPixels( options.stroke ) ) * 2; - var left = this.getPixels( options.x ) - ( width / 2 ); - var top = this.getPixels( options.y ) - ( height / 2 ); - } - var right = left + width; - var bottom = top + height; - - if( this.bound.left === false || left < this.bound.left ) - this.bound.left = left; - if( this.bound.right === false || right > this.bound.right ) - this.bound.right = right; - if( this.bound.top === false || top < this.bound.top ) - this.bound.top = top; - if( this.bound.bottom === false || bottom > this.bound.bottom ) - this.bound.bottom = bottom; - }, - - /** - * Creates the canvas that sits on top of the game's canvas and holds game controls - */ - createOverlayCanvas: function() { - this.canvas = document.createElement( 'canvas' ); - - // Scale to same size as original canvas - this.resize( true ); - - document.getElementsByTagName( 'body' )[0].appendChild( this.canvas ); - this.ctx = this.canvas.getContext( '2d' ); - - var _this = this; - window.addEventListener( 'resize', function() { - // Wait for any other events to finish - setTimeout( function() { GameController.resize.call( _this ); }, 1 ); - } ); - - - // Set the touch events for this new canvas - this.setTouchEvents(); - - // Load in the initial UI elements - this.loadSide( 'left' ); - this.loadSide( 'right' ); - - // Starts up the rendering / drawing - this.render(); - - if( ! this.touches || this.touches.length == 0 ) - this.paused = true; // pause until a touch event - }, - - pixelRatio: 1, - resize: function( firstTime ) { - // Scale to same size as original canvas - this.canvas.width = this.options.canvas.width; - this.canvas.height = this.options.canvas.height; - - this.offsetX = GameController.options.canvas.offsetLeft + document.body.scrollLeft; - this.offsetY = GameController.options.canvas.offsetTop + document.body.scrollTop; - - // Get in on this retina action - if( this.options.canvas.style.width && this.options.canvas.style.height && this.options.canvas.style.height.indexOf( 'px' ) !== -1 ) - { - this.canvas.style.width = this.options.canvas.style.width; - this.canvas.style.height = this.options.canvas.style.height; - this.pixelRatio = this.canvas.width / parseInt( this.canvas.style.width ); - } - - this.canvas.style.position = 'absolute'; - this.canvas.style.zIndex = '5'; - this.canvas.style.left = this.options.canvas.offsetLeft + 'px'; - this.canvas.style.top = this.options.canvas.offsetTop + 'px'; - this.canvas.setAttribute( 'style', this.canvas.getAttribute( 'style' ) +' -ms-touch-action: none;' ); - - if( !firstTime ) - { - // Remove all current buttons - this.touchableAreas = []; - // Clear out the cached sprites - this.cachedSprites = []; - // Reload in the initial UI elements - this.reloadSide( 'left' ); - this.reloadSide( 'right' ); - } - }, - - /** - * Returns the scaled pixels. Given the value passed - * @param {int/string} value - either an integer for # of pixels, or 'x%' for relative - * @param {char} axis - x, y - */ - getPixels: function( value, axis ) - { - if( typeof value === 'undefined' ) - return 0 - else if( typeof value === 'number' ) - return value; - else // a percentage - { - if( axis == 'x' ) - return ( parseInt( value ) / 100 ) * this.canvas.width; - else - return ( parseInt( value ) / 100 ) * this.canvas.height; - } - }, - - /** - * Simulates a key press - * @param {string} eventName - 'down', 'up' - * @param {char} character - */ - simulateKeyEvent: function( eventName, keyCode ) { - if( typeof window.onkeydown === 'undefined' ) // No keyboard, can't simulate... - return false; - - /* If they have jQuery, use it because it works better for mobile safari */ - if( typeof jQuery !== 'undefined' ) - { - var press = jQuery.Event( 'key' + eventName ); - press.ctrlKey = false; - press.which = keyCode; - press.keyCode = keyCode; - // Keypress on just the canvas instead of the document - $( this.options.canvas ).trigger( press ); - return; - } - - var oEvent = document.createEvent( 'KeyboardEvent' ); - - // Chromium Hack - if( navigator.userAgent.toLowerCase().indexOf( 'chrome' ) !== -1 ) - { - Object.defineProperty( oEvent, 'keyCode', { - get : function() { - return this.keyCodeVal; - } - } ); - Object.defineProperty( oEvent, 'which', { - get : function() { - return this.keyCodeVal; - } - } ); - } - - if( oEvent.initKeyboardEvent ) - { - oEvent.initKeyboardEvent( 'key' + eventName, true, true, document.defaultView, false, false, false, false, keyCode, keyCode ); - } - else - { - oEvent.initKeyEvent( 'key' + eventName, true, true, document.defaultView, false, false, false, false, keyCode, keyCode ); - } - - oEvent.keyCodeVal = keyCode; - - }, - - setTouchEvents: function() { - var _this = this; - var touchStart = function( e ) { - if( _this.paused ) - { - _this.paused = false; - } - - e.preventDefault(); - - // Microsoft always has to have their own stuff... - if( window.navigator.msPointerEnabled && e.clientX && e.pointerType == e.MSPOINTER_TYPE_TOUCH ) - { - _this.touches[ e.pointerId ] = { clientX: e.clientX, clientY: e.clientY }; - } - else - { - _this.touches = e.touches || []; - } - }; - - this.canvas.addEventListener( 'touchstart', touchStart, false ); - - var touchEnd = function( e ) { - e.preventDefault(); - - if( window.navigator.msPointerEnabled && e.pointerType == e.MSPOINTER_TYPE_TOUCH ) - { - delete _this.touches[ e.pointerId ]; - } - else - { - _this.touches = e.touches || []; - } - - if( !e.touches || e.touches.length == 0 ) - { - // Draw once more to remove the touch area - _this.render(); - _this.paused = true; - } - }; - this.canvas.addEventListener( 'touchend', touchEnd ); - - var touchMove = function( e ) { - e.preventDefault(); - - if( window.navigator.msPointerEnabled && e.clientX && e.pointerType == e.MSPOINTER_TYPE_TOUCH ) - { - _this.touches[ e.pointerId ] = { clientX: e.clientX, clientY: e.clientY }; - } - else - { - _this.touches = e.touches || []; - } - }; - this.canvas.addEventListener( 'touchmove', touchMove ); - - if( window.navigator.msPointerEnabled ) - { - this.canvas.addEventListener( 'MSPointerDown', touchStart ); - this.canvas.addEventListener( 'MSPointerUp', touchEnd ); - this.canvas.addEventListener( 'MSPointerMove', touchMove ); - } - }, - - /** - * Adds the area to a list of touchable areas, draws - * @param {object} options with properties: x, y, width, height, touchStart, touchEnd, touchMove - */ - addTouchableDirection: function( options ) { - - var direction = new TouchableDirection( options ); - - direction.id = this.touchableAreas.push( direction ); - this.touchableAreasCount++; - - this.boundingSet( options ); - }, - - /** - * Adds the circular area to a list of touchable areas, draws - * @param {object} options with properties: x, y, width, height, touchStart, touchEnd, touchMove - */ - addJoystick: function( options ) { //x, y, radius, backgroundColor, touchStart, touchEnd ) { - - var joystick = new TouchableJoystick( options ); - - joystick.id = this.touchableAreas.push( joystick ); - this.touchableAreasCount++; - - this.boundingSet( options ); - }, - - /** - * Adds the circular area to a list of touchable areas, draws - * @param {object} options with properties: x, y, width, height, touchStart, touchEnd, touchMove - */ - addButton: function( options ) { //x, y, radius, backgroundColor, touchStart, touchEnd ) { - - var button = new TouchableButton( options ); - - button.id = this.touchableAreas.push( button ); - this.touchableAreasCount++; - - this.boundingSet( options ); - }, - - addTouchableArea: function( check, callback ) { - }, - - loadButtons: function( side ) { - var buttons = this.options[ side ].buttons; - var _this = this; - for( var i = 0, j = buttons.length; i < j; i++ ) - { - if( typeof buttons[i] === 'undefined' || typeof buttons[i].offset === 'undefined' ) - continue; - - var posX = this.getPositionX( side ); - var posY = this.getPositionY( side ); - - buttons[i].x = posX + this.getPixels( buttons[i].offset.x, 'y' ); - buttons[i].y = posY + this.getPixels( buttons[i].offset.y, 'y' ); - - this.addButton( buttons[i] ); - } - }, - - loadDPad: function( side ) { - var dpad = this.options[ side ].dpad || {}; - - // Centered value is at this.options[ side ].position - - var _this = this; - - var posX = this.getPositionX( side ); - var posY = this.getPositionY( side ); - - - // If they have all 4 directions, add a circle to the center for looks - if( dpad.up && dpad.left && dpad.down && dpad.right ) - { - var options = { - x: posX, - y: posY, - radius: dpad.right.height - } - var center = new TouchableCircle( options ); - this.touchableAreas.push( center ); - this.touchableAreasCount++; - } - - // Up arrow - if( dpad.up !== false ) - { - dpad.up.x = posX - this.getPixels( dpad.up.width, 'y' ) / 2; - dpad.up.y = posY - ( this.getPixels( dpad.up.height, 'y' ) + this.getPixels( dpad.left.height, 'y' ) / 2 ); - dpad.up.direction = 'up'; - this.addTouchableDirection( dpad.up ); - } - - // Left arrow - if( dpad.left !== false ) - { - dpad.left.x = posX - ( this.getPixels( dpad.left.width, 'y' ) + this.getPixels( dpad.up.width, 'y' ) / 2 ); - dpad.left.y = posY - ( this.getPixels( dpad.left.height, 'y' ) / 2 ); - dpad.left.direction = 'left'; - this.addTouchableDirection( dpad.left ); - } - - // Down arrow - if( dpad.down !== false ) - { - dpad.down.x = posX - this.getPixels( dpad.down.width, 'y' ) / 2; - dpad.down.y = posY + ( this.getPixels( dpad.left.height, 'y' ) / 2 ); - dpad.down.direction = 'down'; - this.addTouchableDirection( dpad.down ); - } - - // Right arrow - if( dpad.right !== false ) - { - dpad.right.x = posX + ( this.getPixels( dpad.up.width, 'y' ) / 2 ); - dpad.right.y = posY - this.getPixels( dpad.right.height, 'y' ) / 2; - dpad.right.direction = 'right'; - this.addTouchableDirection( dpad.right ); - } - - }, - - loadJoystick: function( side ) { - var joystick = this.options[ side ].joystick; - joystick.x = this.getPositionX( side ); - joystick.y = this.getPositionY( side ); - - this.addJoystick( joystick ); - }, - - /** - * Used for resizing. Currently is just an alias for loadSide - */ - reloadSide: function( side ) { - // Load in new ones - this.loadSide( side ); - }, - - loadSide: function( side ) { - if( this.options[ side ].type === 'dpad' ) - { - this.loadDPad( side ); - } - else if( this.options[ side ].type === 'joystick' ) - { - this.loadJoystick( side ); - } - else if( this.options[ side ].type === 'buttons' ) - { - this.loadButtons( side ); - } - }, - - /** - * Normalize touch positions by the left and top offsets - * @param {int} x - */ - normalizeTouchPositionX: function( x ) - { - return ( x - this.offsetX ) * ( this.pixelRatio ); - }, - - /** - * Normalize touch positions by the left and top offsets - * @param {int} y - */ - normalizeTouchPositionY: function( y ) - { - return ( y - this.offsetY ) * ( this.pixelRatio ); - }, - - /** - * Returns the x position when given # of pixels from right (based on canvas size) - * @param {int} right - */ - getXFromRight: function( right ) { - return this.canvas.width - right; - }, - - - /** - * Returns the y position when given # of pixels from bottom (based on canvas size) - * @param {int} right - */ - getYFromBottom: function( bottom ) { - return this.canvas.height - bottom; - }, - - /** - * Grabs the x position of either the left or right side/controls - * @param {string} side - 'left', 'right' - */ - getPositionX: function( side ) { - if( typeof this.options[ side ].position.left !== 'undefined' ) - return this.getPixels( this.options[ side ].position.left, 'x' ); - else - return this.getXFromRight( this.getPixels( this.options[ side ].position.right, 'x' ) ); - }, - - /** - * Grabs the y position of either the left or right side/controls - * @param {string} side - 'left', 'right' - */ - getPositionY: function( side ) { - if( typeof this.options[ side ].position.top !== 'undefined' ) - return this.getPixels( this.options[ side ].position.top, 'y' ); - else - return this.getYFromBottom( this.getPixels( this.options[ side ].position.bottom, 'y' ) ); - }, - - /** - * Processes the info for each touchableArea - */ - renderAreas: function() { - for( var i = 0, j = this.touchableAreasCount; i < j; i++ ) - { - var area = this.touchableAreas[ i ]; - - if( typeof area === 'undefined' ) - continue; - - area.draw(); - - // Go through all touches to see if any hit this area - var touched = false; - for( var k = 0, l = this.touches.length; k < l; k++ ) - { - var touch = this.touches[ k ]; - if( typeof touch === 'undefined' ) - continue; - - var x = this.normalizeTouchPositionX( touch.clientX ), y = this.normalizeTouchPositionY( touch.clientY ); - - // Check that it's in the bounding box/circle - if( ( area.check( x, y ) ) !== false ) - { - if( !touched ) - touched = this.touches[ k ]; - } - } - - if( touched ) - { - if( !area.active ) - area.touchStartWrapper( touched ); - area.touchMoveWrapper( touched ); - } - else if( area.active ) - { - area.touchEndWrapper( touched ); - } - } - }, - - render: function() { - if( ! this.paused || ! this.performanceFriendly ) - this.ctx.clearRect( this.bound.left, this.bound.top, this.bound.right - this.bound.left, this.bound.bottom - this.bound.top ); - - // Draw feedback for when screen is being touched - // When no touch events are happening, this enables 'paused' mode, which skips running this - // This isn't run at all in performanceFriendly mode - if( ! this.paused && ! this.performanceFriendly ) - { - var cacheId = 'touch-circle'; - var cached = this.cachedSprites[ cacheId ]; - - if( ! cached && this.options.touchRadius ) - { - var subCanvas = document.createElement( 'canvas' ); - var ctx = subCanvas.getContext( '2d' ); - subCanvas.width = 2 * this.options.touchRadius; - subCanvas.height = 2 * this.options.touchRadius; - - var center = this.options.touchRadius; - var gradient = ctx.createRadialGradient( center, center, 1, center, center, this.options.touchRadius ); // 10 = end radius - gradient.addColorStop( 0, 'rgba( 200, 200, 200, 1 )' ); - gradient.addColorStop( 1, 'rgba( 200, 200, 200, 0 )' ); - ctx.beginPath(); - ctx.fillStyle = gradient; - ctx.arc( center, center, this.options.touchRadius, 0 , 2 * Math.PI, false ); - ctx.fill(); - - cached = GameController.cachedSprites[ cacheId ] = subCanvas; - } - // Draw the current touch positions if any - for( var i = 0, j = this.touches.length; i < j; i++ ) - { - var touch = this.touches[ i ]; - if( typeof touch === 'undefined' ) - continue; - var x = this.normalizeTouchPositionX( touch.clientX ), y = this.normalizeTouchPositionY( touch.clientY ); - if( x - this.options.touchRadius > this.bound.left && x + this.options.touchRadius < this.bound.right && - y - this.options.touchRadius > this.bound.top && y + this.options.touchRadius < this.bound.bottom ) - this.ctx.drawImage( cached, x - this.options.touchRadius, y - this.options.touchRadius ); - } - } - - // Render if the game isn't paused, or we're not in performanceFriendly mode (running when not paused keeps the semi-transparent gradients looking better for some reason) - if( ! this.paused || ! this.performanceFriendly ) - { - // Process all the info for each touchable area - this.renderAreas(); - } - - window.requestAnimationFrame( this.renderWrapper ); - }, - /** - * So we can keep scope, and don't have to create a new obj every requestAnimationFrame (bad for garbage collection) - */ - renderWrapper: function() { - GameController.render(); - }, - } - - /** - * Superclass for touchable stuff - */ - var TouchableArea = ( function() { - - function TouchableArea() - { - } - - // Called when this direction is being touched - TouchableArea.prototype.touchStart = null; - - // Called when this direction is being moved - TouchableArea.prototype.touchMove = null; - - // Called when this direction is no longer being touched - TouchableArea.prototype.touchEnd = null; - - TouchableArea.prototype.type = 'area'; - TouchableArea.prototype.id = false; - TouchableArea.prototype.active = false; - - /** - * Sets the user-specified callback for this direction being touched - * @param {function} callback - */ - TouchableArea.prototype.setTouchStart = function( callback ) { - this.touchStart = callback; - }; - - /** - * Called when this direction is no longer touched - */ - TouchableArea.prototype.touchStartWrapper = function( e ) { - // Fire the user specified callback - if( this.touchStart ) - this.touchStart(); - - // Mark this direction as active - this.active = true; - }; - - /** - * Sets the user-specified callback for this direction no longer being touched - * @param {function} callback - */ - TouchableArea.prototype.setTouchMove = function( callback ) { - this.touchMove = callback; - }; - - /** - * Called when this direction is moved. Make sure it's actually changed before passing to developer - */ - TouchableArea.prototype.lastPosX = 0; - TouchableArea.prototype.lastPosY = 0; - TouchableArea.prototype.touchMoveWrapper = function( e ) { - // Fire the user specified callback - if( this.touchMove && ( e.clientX != TouchableArea.prototype.lastPosX || e.clientY != TouchableArea.prototype.lastPosY ) ) - { - this.touchMove(); - this.lastPosX = e.clientX; - this.lastPosY = e.clientY; - } - // Mark this direction as active - this.active = true; - }; - - /** - * Sets the user-specified callback for this direction no longer being touched - * @param {function} callback - */ - TouchableArea.prototype.setTouchEnd = function( callback ) { - this.touchEnd = callback; - }; - - /** - * Called when this direction is first touched - */ - TouchableArea.prototype.touchEndWrapper = function( e ) { - // Fire the user specified callback - if( this.touchEnd ) - this.touchEnd(); - - // Mark this direction as inactive - this.active = false; - - GameController.render(); - }; - - return TouchableArea; - - } )(); - - var TouchableDirection = ( function( __super ) { - __extends( TouchableDirection, __super ); - - function TouchableDirection( options ) - { - for( var i in options ) - { - if( i == 'x' ) - this[i] = GameController.getPixels( options[i], 'x' ); - else if( i == 'y' || i == 'height' || i == 'width' ) - this[i] = GameController.getPixels( options[i], 'y' ); - else - this[i] = options[i]; - } - - this.draw(); - } - - TouchableDirection.prototype.type = 'direction'; - - /** - * Checks if the touch is within the bounds of this direction - */ - TouchableDirection.prototype.check = function( touchX, touchY ) { - var distanceX, distanceY; - if( ( Math.abs( touchX - this.x ) < ( GameController.options.touchRadius / 2 ) || ( touchX > this.x ) ) && // left - ( Math.abs( touchX - ( this.x + this.width ) ) < ( GameController.options.touchRadius / 2 ) || ( touchX < this.x + this.width ) ) && // right - ( Math.abs( touchY - this.y ) < ( GameController.options.touchRadius / 2 ) || ( touchY > this.y ) ) && // top - ( Math.abs( touchY - ( this.y + this.height ) ) < ( GameController.options.touchRadius / 2 ) || ( touchY < this.y + this.height ) ) // bottom - ) - return true; - - return false; - }; - - TouchableDirection.prototype.draw = function() { - var cacheId = this.type + '' + this.id + '' + this.active; - var cached = GameController.cachedSprites[ cacheId ]; - if( ! cached ) - { - var subCanvas = document.createElement( 'canvas' ); - var ctx = subCanvas.getContext( '2d' ); - subCanvas.width = this.width + 2 * this.stroke; - subCanvas.height = this.height + 2 * this.stroke; - - var opacity = this.opacity || 0.9; - - if( ! this.active ) // Direction currently being touched - opacity *= 0.5; - - switch( this.direction ) - { - case 'up': - var gradient = ctx.createLinearGradient( 0, 0, 0, this.height ); - gradient.addColorStop( 0, 'rgba( 0, 0, 0, ' + ( opacity * 0.5 ) + ' )' ); - gradient.addColorStop( 1, 'rgba( 0, 0, 0, ' + opacity + ' )' ); - break; - case 'left': - var gradient = ctx.createLinearGradient( 0, 0, this.width, 0 ); - gradient.addColorStop( 0, 'rgba( 0, 0, 0, ' + ( opacity * 0.5 ) + ' )' ); - gradient.addColorStop( 1, 'rgba( 0, 0, 0, ' + opacity + ' )' ); - break; - case 'right': - var gradient = ctx.createLinearGradient( 0, 0, this.width, 0 ); - gradient.addColorStop( 0, 'rgba( 0, 0, 0, ' + opacity + ' )' ); - gradient.addColorStop( 1, 'rgba( 0, 0, 0, ' + ( opacity * 0.5 ) + ' )' ); - break; - case 'down': - default: - var gradient = ctx.createLinearGradient( 0, 0, 0, this.height ); - gradient.addColorStop( 0, 'rgba( 0, 0, 0, ' + opacity + ' )' ); - gradient.addColorStop( 1, 'rgba( 0, 0, 0, ' + ( opacity * 0.5 ) + ' )' ); - } - ctx.fillStyle = gradient; - - ctx.fillRect( 0, 0, this.width, this.height ); - ctx.lineWidth = this.stroke; - ctx.strokeStyle = 'rgba( 255, 255, 255, 0.1 )'; - ctx.strokeRect( 0, 0, this.width, this.height ); - - cached = GameController.cachedSprites[ cacheId ] = subCanvas; - } - - GameController.ctx.drawImage( cached, this.x, this.y ); - - - }; - - return TouchableDirection; - } )( TouchableArea ); - - var TouchableButton = ( function( __super ) { - __extends( TouchableButton, __super ); - - function TouchableButton( options ) //x, y, radius, backgroundColor ) - { - for( var i in options ) - { - if( i == 'x' ) - this[i] = GameController.getPixels( options[i], 'x' ); - else if( i == 'x' || i == 'radius' ) - this[i] = GameController.getPixels( options[i], 'y' ); - else - this[i] = options[i]; - } - - this.draw(); - } - - TouchableButton.prototype.type = 'button'; - - /** - * Checks if the touch is within the bounds of this direction - */ - TouchableButton.prototype.check = function( touchX, touchY ) { - if( - ( Math.abs( touchX - this.x ) < this.radius + ( GameController.options.touchRadius / 2 ) ) && - ( Math.abs( touchY - this.y ) < this.radius + ( GameController.options.touchRadius / 2 ) ) - ) - return true; - - return false; - }; - - TouchableButton.prototype.draw = function() { - var cacheId = this.type + '' + this.id + '' + this.active; - var cached = GameController.cachedSprites[ cacheId ]; - if( ! cached ) - { - var subCanvas = document.createElement( 'canvas' ); - var ctx = subCanvas.getContext( '2d' ); - ctx.lineWidth = this.stroke; - subCanvas.width = subCanvas.height = 2 * ( this.radius + ctx.lineWidth ); - - - var gradient = ctx.createRadialGradient( this.radius, this.radius, 1, this.radius, this.radius, this.radius ); - var textShadowColor; - switch( this.backgroundColor ) - { - case 'blue': - gradient.addColorStop( 0, 'rgba(123, 181, 197, 0.6)' ); - gradient.addColorStop( 1, '#105a78' ); - textShadowColor = '#0A4861'; - break; - case 'green': - gradient.addColorStop( 0, 'rgba(29, 201, 36, 0.6)' ); - gradient.addColorStop( 1, '#107814' ); - textShadowColor = '#085C0B'; - break; - case 'red': - gradient.addColorStop( 0, 'rgba(165, 34, 34, 0.6)' ); - gradient.addColorStop( 1, '#520101' ); - textShadowColor = '#330000'; - break; - case 'yellow': - gradient.addColorStop( 0, 'rgba(219, 217, 59, 0.6)' ); - gradient.addColorStop( 1, '#E8E10E' ); - textShadowColor = '#BDB600'; - break; - case 'white': - default: - gradient.addColorStop( 0, 'rgba( 255,255,255,.3 )' ); - gradient.addColorStop( 1, '#eee' ); - break; - } - - if( this.active ) - ctx.fillStyle = textShadowColor; - else - ctx.fillStyle = gradient; - - ctx.strokeStyle = textShadowColor; - - ctx.beginPath(); - //ctx.arc( this.x, this.y, this.radius, 0 , 2 * Math.PI, false ); - ctx.arc( subCanvas.width / 2, subCanvas.width / 2, this.radius, 0 , 2 * Math.PI, false ); - ctx.fill(); - ctx.stroke(); - - if( this.label ) - { - // Text Shadow - ctx.fillStyle = textShadowColor; - ctx.font = 'bold ' + ( this.fontSize || subCanvas.height * 0.35 ) + 'px Verdana'; - ctx.textAlign = 'center'; - ctx.textBaseline = 'middle'; - ctx.fillText( this.label, subCanvas.height / 2 + 2, subCanvas.height / 2 + 2 ); - - - ctx.fillStyle = this.fontColor; - ctx.font = 'bold ' + ( this.fontSize || subCanvas.height * 0.35 ) + 'px Verdana'; - ctx.textAlign = 'center'; - ctx.textBaseline = 'middle'; - ctx.fillText( this.label, subCanvas.height / 2, subCanvas.height / 2 ); - } - - cached = GameController.cachedSprites[ cacheId ] = subCanvas; - } - - GameController.ctx.drawImage( cached, this.x, this.y ); - - - }; - - return TouchableButton; - } )( TouchableArea ); - - var TouchableJoystick = ( function( __super ) { - __extends( TouchableJoystick, __super ); - - function TouchableJoystick( options ) //x, y, radius, backgroundColor ) - { - for( var i in options ) - this[i] = options[i]; - - this.currentX = this.currentX || this.x; - this.currentY = this.currentY || this.y; - } - - TouchableJoystick.prototype.type = 'joystick'; - - /** - * Checks if the touch is within the bounds of this direction - */ - TouchableJoystick.prototype.check = function( touchX, touchY ) { - if( - ( Math.abs( touchX - this.x ) < this.radius + ( GameController.getPixels( GameController.options.touchRadius ) / 2 ) ) && - ( Math.abs( touchY - this.y ) < this.radius + ( GameController.getPixels( GameController.options.touchRadius ) / 2 ) ) - ) - return true; - - return false; - }; - - /** - * details for the joystick move event, stored here so we're not constantly creating new objs for garbage. The object has params: - * dx - the number of pixels the current joystick center is from the base center in x direction - * dy - the number of pixels the current joystick center is from the base center in y direction - * max - the maximum number of pixels dx or dy can be - * normalizedX - a number between -1 and 1 relating to how far left or right the joystick is - * normalizedY - a number between -1 and 1 relating to how far up or down the joystick is - */ - TouchableJoystick.prototype.moveDetails = {}; - - /** - * Called when this joystick is moved - */ - TouchableJoystick.prototype.touchMoveWrapper = function( e ) { - this.currentX = GameController.normalizeTouchPositionX( e.clientX ); - this.currentY = GameController.normalizeTouchPositionY( e.clientY ); - - // Fire the user specified callback - if( this.touchMove ) - { - if( this.moveDetails.dx != this.currentX - this.x && this.moveDetails.dy != this.y - this.currentY ) - { - this.moveDetails.dx = this.currentX - this.x; // reverse so right is positive - this.moveDetails.dy = this.y - this.currentY; - this.moveDetails.max = this.radius + ( GameController.options.touchRadius / 2 ); - this.moveDetails.normalizedX = this.moveDetails.dx / this.moveDetails.max; - this.moveDetails.normalizedY = this.moveDetails.dy / this.moveDetails.max; - - this.touchMove( this.moveDetails ); - } - } - - - // Mark this direction as inactive - this.active = true; - }; - - TouchableJoystick.prototype.draw = function() { - if( ! this.id ) // wait until id is set - return false; - - var cacheId = this.type + '' + this.id + '' + this.active; - var cached = GameController.cachedSprites[ cacheId ]; - if( ! cached ) - { - var subCanvas = document.createElement( 'canvas' ); - this.stroke = this.stroke || 2; - subCanvas.width = subCanvas.height = 2 * ( this.radius + ( GameController.options.touchRadius ) + this.stroke ); - - var ctx = subCanvas.getContext( '2d' ); - ctx.lineWidth = this.stroke; - if( this.active ) // Direction currently being touched - { - var gradient = ctx.createRadialGradient( 0, 0, 1, 0, 0, this.radius ); - gradient.addColorStop( 0, 'rgba( 200,200,200,.5 )' ); - gradient.addColorStop( 1, 'rgba( 200,200,200,.9 )' ); - ctx.strokeStyle = '#000'; - } - else - { - // STYLING FOR BUTTONS - var gradient = ctx.createRadialGradient( 0, 0, 1, 0, 0, this.radius ); - gradient.addColorStop( 0, 'rgba( 200,200,200,.2 )' ); - gradient.addColorStop( 1, 'rgba( 200,200,200,.4 )' ); - ctx.strokeStyle = 'rgba( 0,0,0,.4 )'; - } - ctx.fillStyle = gradient; - // Actual joystick part that is being moved - ctx.beginPath(); - ctx.arc( this.radius, this.radius, this.radius, 0 , 2 * Math.PI, false ); - ctx.fill(); - ctx.stroke(); - - cached = GameController.cachedSprites[ cacheId ] = subCanvas; - } - - // Draw the base that stays static - GameController.ctx.fillStyle = '#444'; - GameController.ctx.beginPath(); - GameController.ctx.arc( this.x, this.y, this.radius * 0.7, 0 , 2 * Math.PI, false ); - GameController.ctx.fill(); - GameController.ctx.stroke(); - - GameController.ctx.drawImage( cached, this.currentX - this.radius, this.currentY - this.radius ); - - - }; - - return TouchableJoystick; - } )( TouchableArea ); - - - var TouchableCircle = ( function( __super ) { - __extends( TouchableCircle, __super ); - - function TouchableCircle( options ) - { - for( var i in options ) - { - if( i == 'x' ) - this[i] = GameController.getPixels( options[i], 'x' ); - else if( i == 'x' || i == 'radius' ) - this[i] = GameController.getPixels( options[i], 'y' ); - else - this[i] = options[i]; - } - - this.draw(); - } - - /** - * No touch for this fella - */ - TouchableCircle.prototype.check = function( touchX, touchY ) { - return false; - }; - - TouchableCircle.prototype.draw = function() { - - // STYLING FOR BUTTONS - GameController.ctx.fillStyle = 'rgba( 0, 0, 0, 0.5 )'; - - // Actual joystick part that is being moved - GameController.ctx.beginPath(); - GameController.ctx.arc( this.x, this.y, this.radius, 0 , 2 * Math.PI, false ); - GameController.ctx.fill(); - - }; - - return TouchableCircle; - } )( TouchableArea ); - - /** - * Shim for requestAnimationFrame - */ - ( function() { - if (typeof module !== "undefined") return - var lastTime = 0; - var vendors = ['ms', 'moz', 'webkit', 'o']; - for( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x ) - { - window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] - || window[vendors[x]+'CancelRequestAnimationFrame']; - } - - if ( !window.requestAnimationFrame ) - window.requestAnimationFrame = function( callback, element ) { - var currTime = new Date().getTime(); - var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); - var id = window.setTimeout( function() { callback(currTime + timeToCall); }, - timeToCall ); - lastTime = currTime + timeToCall; - return id; - }; - - if ( !window.cancelAnimationFrame ) - window.cancelAnimationFrame = function( id ) { - clearTimeout( id ); - }; - }() ); -} )(typeof module !== "undefined" ? module.exports : window) diff --git a/examples/_site/js/jquery-2.0.3.min.js b/examples/_site/js/jquery-2.0.3.min.js deleted file mode 100644 index 2be209dd2..000000000 --- a/examples/_site/js/jquery-2.0.3.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery-2.0.3.min.map -*/ -(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="
",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t) -};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*\s*$/g,ct={option:[1,""],thead:[1,"Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.
-Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna.
-- var Phaser; - (function (Phaser) { - var Basic = (function () { - function Basic(game) { - this.name = 'Space Harrier'; - this._game = game; - this.ID = -1; - this.exists = true; - this.active = true; - } - Basic.prototype.destroy = - function () { - }; - // Code Comment - Basic.prototype.toString = - function () { - return ""; - }; - return Basic; - })(); - Phaser.Basic = Basic; - })(Phaser || (Phaser = {})); -- -
audio
-9 examples
-Collision
-3 examples
-Tilemaps
-7 examples
-Source code:
- - - - - - diff --git a/examples/_site/view_lite.html b/examples/_site/view_lite.html deleted file mode 100644 index 1dbf9cfcb..000000000 --- a/examples/_site/view_lite.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -Total Examples:
- - - -TweenGroup
.
-*
-* @class Phaser.TweenGroup
-* @constructor
-* @param {Phaser.Game} game - Current game instance.
-* @param {number} delay - Delay before this tween will start, defaults to 0 (no delay).
-* @param {number} repeat - How many time should the TweenGroup repeat itself. Infinity can be used for infinite repetition.
-* @param {Phaser.Tween} yoyo - Whether this TweenGroup will reverse on completion.
-* @param {boolean} autoStart - Whether this TweenGroup will start automatically or not.
-*/
-Phaser.TweenGroup = function (game, delay, repeat, yoyo, autoStart) {
-
- autoStart = autoStart || true;
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running Game.
- */
- this.game = game;
-
- /**
- * @property {number} _duration - Description.
- * @private
- * @default
- */
- this._duration = 0;
-
- /**
- * @property {number} _repeat - Description.
- * @private
- * @default
- */
- this._repeat = repeat || 0;
-
- /**
- * @property {boolean} _yoyo - Description.
- * @private
- * @default
- */
- this._yoyo = yoyo || false;
-
- /**
- * @property {boolean} _reversed - Description.
- * @private
- * @default
- */
- this._reversed = false;
-
- /**
- * @property {number} _delayTime - Description.
- * @private
- * @default
- */
- this._delayTime = delay || 0;
-
- /**
- * @property {Description} _startTime - Description.
- * @private
- * @default null
- */
- this._startTime = null;
-
- /**
- * @property {Description} _onStartCallback - Description.
- * @private
- * @default
- */
- this._onStartCallback = null;
-
- /**
- * @property {boolean} _onStartCallbackFired - Description.
- * @private
- * @default
- */
- this._onStartCallbackFired = false;
-
- /**
- * @property {Description} _onUpdateCallback - Description.
- * @private
- * @default null
- */
- this._onUpdateCallback = null;
-
- /**
- * @property {Description} _onCompleteCallback - Description.
- * @private
- * @default null
- */
- this._onCompleteCallback = null;
-
- /**
- * @property {boolean} _paused - Description.
- * @private
- * @default false
- */
- this._paused = false;
-
- /**
- * @property {number} _pausedTime - Description.
- * @private
- * @default
- */
- this._pausedTime = 0;
-
- /**
- * @property {boolean} pendingDelete - If this TweenGroup is ready to be deleted by the TweenManager.
- * @default
- */
- this.pendingDelete = false;
-
- /**
- * @property {Phaser.Signal} onStart - Description.
- */
- this.onStart = new Phaser.Signal();
-
- /**
- * @property {Phaser.Signal} onComplete - Description.
- */
- this.onComplete = new Phaser.Signal();
-
- /**
- * @property {boolean} isRunning - Description.
- * @default
- */
- this.isRunning = false;
-
- /**
- * @property {number} _time - Description.
- * @private
- */
- this._time = 0;
-
- /**
- * @property {array} _tweens - Description.
- * @private
- */
- this._tweens = [];
-
- /**
- * @property {array} _add - Description.
- * @private
- */
- this._add = [];
-
- /**
- * @property {boolean} _dirty - Description.
- * @private
- */
- this._dirty = false;
-
- if (autoStart) {
- this.start();
- }
-
-};
-
-Phaser.TweenGroup.prototype = {
-
- /**
- * Create and configure a tween that will be added to this group
- *
- * @method Phaser.TweenGroup#to
- * @param {object} object - Object to tween.
- * @param {object} properties - Properties you want to tween.
- * @param {number} duration - Duration of this tween.
- * @param {function} ease - Easing function.
- * @param {boolean} autoStart - Whether this tween will start automatically or not.
- * @param {number} delay - Delay before this tween will start, defaults to 0 (no delay).
- * @param {boolean} repeat - Should the tween automatically restart once complete? (ignores any chained tweens).
- * @param {Phaser.Tween} yoyo - Description.
- * @return {Phaser.TweenGroup} Itself.
- */
- to: function ( object, properties, duration, ease, autoStart, delay, repeat, yoyo ) {
-
- var tween = new Phaser.Tween(object, this.game);
- tween.to(properties, duration, ease, autoStart, delay, repeat, yoyo);
- this.add(tween);
-
- return this;
-
- },
-
- /**
- * Starts the TweenGroup.
- *
- * @method Phaser.TweenGroup#start
- * @return {Phaser.TweenGroup} Itself.
- */
- start: function () {
-
- this.game.tweens.add(this);
-
- this.onStart.dispatch();
-
- this.isRunning = true;
-
- this._onStartCallbackFired = false;
-
- this._startTime = this.game.time.now + this._delayTime;
-
- return this;
-
- },
-
- /**
- * Stops the TweenGroup if running and removes it from the TweenManager. If there are any onComplete callbacks or events they are not dispatched.
- *
- * @method Phaser.TweenGroup#stop
- * @return {Phaser.TweenGroup} Itself.
- */
- stop: function () {
-
- this.game.tweens.remove(this);
- this.isRunning = false;
-
- return this;
-
- },
-
- /**
- * Sets a delay time before this tween will start.
- *
- * @method Phaser.TweenGroup#delay
- * @param {number} amount - The amount of the delay in ms.
- * @return {Phaser.TweenGroup} Itself.
- */
- delay: function ( amount ) {
-
- this._delayTime = amount;
- return this;
-
- },
-
- /**
- * Sets the number of times this tween will repeat.
- *
- * @method Phaser.TweenGroup#repeat
- * @param {number} times - How many times to repeat.
- * @return {Phaser.TweenGroup} Itself.
- */
- repeat: function ( times ) {
-
- this._repeat = times;
- return this;
-
- },
-
- /**
- * A tween that has yoyo set to true will run through from start to finish, then reverse from finish to start.
- * Used in combination with repeat you can create endless loops.
- *
- * @method Phaser.TweenGroup#yoyo
- * @param {boolean} yoyo - Set to true to yoyo this tween.
- * @return {Phaser.TweenGroup} Itself.
- */
- yoyo: function( yoyo ) {
-
- this._yoyo = yoyo;
- return this;
-
- },
-
- /**
- * Sets a callback to be fired when the tween starts. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.TweenGroup#onStartCallback
- * @param {function} callback - The callback to invoke on start.
- * @return {Phaser.TweenGroup} Itself.
- */
- onStartCallback: function ( callback ) {
-
- this._onStartCallback = callback;
- return this;
-
- },
-
- /**
- * Sets a callback to be fired each time this tween updates. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.TweenGroup#onUpdateCallback
- * @param {function} callback - The callback to invoke each time this tween is updated.
- * @return {Phaser.TweenGroup} Itself.
- */
- onUpdateCallback: function ( callback ) {
-
- this._onUpdateCallback = callback;
- return this;
-
- },
-
- /**
- * Sets a callback to be fired when the tween completes. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.TweenGroup#onCompleteCallback
- * @param {function} callback - The callback to invoke on completion.
- * @return {Phaser.TweenGroup} Itself.
- */
- onCompleteCallback: function ( callback ) {
-
- this._onCompleteCallback = callback;
- return this;
-
- },
-
- /**
- * Pauses the tween.
- *
- * @method Phaser.TweenGroup#pause
- */
- pause: function () {
- this._paused = true;
- this._pausedTime = this.game.time.now;
- },
-
- /**
- * Resumes a paused tween.
- *
- * @method Phaser.TweenGroup#resume
- */
- resume: function () {
- this._paused = false;
- this._startTime += (this.game.time.now - this._pausedTime);
- },
-
- /**
- * Core tween update function called by the TweenManager. Does not need to be invoked directly.
- *
- * @method Phaser.TweenGroup#update
- * @param {number} time - A timestamp passed in by the TweenManager.
- * @return {boolean} false if the tween has completed and should be deleted from the manager, otherwise true (still active).
- */
- update: function ( time ) {
- var i = 0,
- numTweens = this._tweens.length,
- tween = null;
-
- var rtime = 0;
-
- if ( this._onStartCallbackFired === false ) {
-
- if ( this._onStartCallback !== null ) {
-
- this._onStartCallback.call(this);
-
- }
-
- this.onStart.dispatch(this);
-
- this._onStartCallbackFired = true;
-
- }
-
- if ( this._dirty && numTweens > 0) {
-
- var max = 0;
-
- for (var j = numTweens - 1; j >= 0; j--) {
- tween = this._tweens[j];
-
- if ( max < ( tween._startTime + tween._duration ) ) {
- max = tween._startTime + tween._duration;
- }
- }
-
- this._duration = max;
-
- this._dirty = false;
-
- }
-
- while ( i < numTweens ) {
-
- tween = this._tweens[ i ];
-
- if ( ( time < tween._startTime ) || ( time > ( tween._startTime + tween._duration )) || tween._paused) {
-
- i++;
- continue;
-
- }
-
- rtime = time - tween._startTime;
-
- tween.update( rtime );
-
- i++;
- }
-
- if ( this._onUpdateCallback !== null ) {
-
- this._onUpdateCallback.call(this);
-
- }
-
- if ( ( ( time >= this._duration ) && !this._reversed ) || ( ( time <= 0) && this._reversed ) ) {
-
- this.onComplete.dispatch(this);
-
- if ( this._onCompleteCallback !== null ) {
- this._onCompleteCallback.call(this);
- }
-
- if ( this._repeat > 0 ) {
-
- if ( isFinite( this._repeat ) ) {
- this._repeat--;
- }
-
- if (this._yoyo) {
- this._reversed = !this._reversed;
- }
-
- this._startTime = this.game.time.now + this._delayTime;
-
- } else {
- return false;
- }
-
- }
-
- if (this._add.length > 0)
- {
- this._tweens = this._tweens.concat(this._add);
- this._add.length = 0;
- }
-
- return true;
- },
-
- /**
- * Add a new tween into the TweenGroup.
- *
- * @method Phaser.TweenGroup#add
- * @param {Phaser.Tween} tween - The tween object you want to add.
- * @returns {Phaser.Tween} The tween object you added to the group.
- */
- add: function ( tween ) {
-
- if ( this.isRunning ) {
- this._add.push( tween );
- } else {
- this._tweens.push( tween );
- }
-
- tween._startTime = this._duration + tween._delayTime;
-
- if ( ( tween._startTime + tween._duration ) > this._duration ) {
- this._duration = tween._startTime + tween._duration;
- }
-
- this._dirty = true;
-
- },
-
- /**
- * Remove a tween from this TweenGroup.
- *
- * @method Phaser.TweenGroup#remove
- * @param {Phaser.Tween} tween - The tween object you want to remove.
- */
- remove: function ( tween ) {
-
- var i = this._tweens.indexOf( tween );
-
- if ( i !== -1 ) {
-
- this._tweens[i].pendingDelete = true;
-
- }
-
- this._dirty = true;
-
- }
-
-};
diff --git a/examples/wip/alpha-mask.js b/examples/wip/alpha-mask.js
deleted file mode 100644
index 72d6824fd..000000000
--- a/examples/wip/alpha-mask.js
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('pic', 'assets/pics/questar.png');
- game.load.image('mask1', 'assets/pics/mask-test.png');
- game.load.image('mask2', 'assets/pics/mask-test2.png');
-
-}
-
-var pic;
-
-function create() {
-
- var bmd = game.make.bitmapData(320, 256);
-
- bmd.alphaMask('pic', 'mask2');
-
- pic = game.add.sprite(0, 0, bmd);
-
- pic.scale.set(2);
-
-}
-
-function update() {
-
-
-}
-
-function render() {
-
-}
diff --git a/examples/wip/anim-speed.js b/examples/wip/anim-speed.js
deleted file mode 100644
index a6fd855e5..000000000
--- a/examples/wip/anim-speed.js
+++ /dev/null
@@ -1,48 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
-
-}
-
-var mummy;
-var anim;
-
-function create() {
-
- game.stage.backgroundColor = 0x2d2d2d;
-
- mummy = game.add.sprite(300, 200, 'mummy', 5);
-
- anim = mummy.animations.add('walk');
-
- anim.play(10, true);
-
- game.input.onDown.add(changeSpeed, this);
-
-}
-
-function changeSpeed(pointer) {
-
- if (pointer.x < 400)
- {
- anim.speed -= 1;
- }
- else
- {
- anim.speed += 1;
- }
-
-}
-
-function update() {
-
-}
-
-function render() {
-
- game.debug.text(anim.speed, 32, 32);
-
-}
\ No newline at end of file
diff --git a/examples/wip/anim1.js b/examples/wip/anim1.js
deleted file mode 100644
index a6e42d6df..000000000
--- a/examples/wip/anim1.js
+++ /dev/null
@@ -1,36 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
-
-}
-
-var mummy;
-var anim;
-
-function create() {
-
- game.stage.backgroundColor = 0xff8855;
-
- mummy = game.add.sprite(300, 200, 'mummy', 5);
-
- mummy.animations.updateIfVisible = false;
-
- anim = mummy.animations.add('walk');
-
- anim.play(2, false);
- // anim.play(2, true);
-
-}
-
-function update() {
-
-}
-
-function render() {
-
- game.debug.text(anim.frame + ' / 17', 32, 32);
-
-}
\ No newline at end of file
diff --git a/examples/wip/animated tilesprite.js b/examples/wip/animated tilesprite.js
deleted file mode 100644
index 1b22906b3..000000000
--- a/examples/wip/animated tilesprite.js
+++ /dev/null
@@ -1,75 +0,0 @@
-
-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.text(sprite.frame, 32, 32);
-
-}
diff --git a/examples/wip/animation events.js b/examples/wip/animation events.js
deleted file mode 100644
index 1d04dbfba..000000000
--- a/examples/wip/animation events.js
+++ /dev/null
@@ -1,69 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
-
-function preload() {
-
- game.load.image('lazur', 'assets/pics/thorn_lazur.png');
- game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
-
-}
-
-var back;
-var mummy;
-var anim;
-var loopText;
-
-function create() {
-
- game.stage.smoothed = false;
-
- back = game.add.image(0, -400, 'lazur');
- back.scale.set(2);
-
- mummy = game.add.sprite(200, 360, 'mummy', 5);
- mummy.scale.set(4);
-
- anim = mummy.animations.add('walk');
-
- anim.onStart.add(animationStarted, this);
- anim.onLoop.add(animationLooped, this);
- anim.onComplete.add(animationStopped, this);
-
- anim.play(10, true);
-
-}
-
-function animationStarted(sprite, animation) {
-
- game.add.text(32, 32, 'Animation started', { fill: 'white' });
-
-}
-
-function animationLooped(sprite, animation) {
-
- if (animation.loopCount === 1)
- {
- loopText = game.add.text(32, 64, 'Animation looped', { fill: 'white' });
- }
- else
- {
- loopText.text = 'Animation looped x2';
- animation.loop = false;
- }
-
-}
-
-function animationStopped(sprite, animation) {
-
- game.add.text(32, 64+32, 'Animation stopped', { fill: 'white' });
-
-}
-
-function update() {
-
- if (anim.isPlaying)
- {
- back.x -= 1;
- }
-
-}
\ No newline at end of file
diff --git a/examples/wip/astro balls.js b/examples/wip/astro balls.js
deleted file mode 100644
index d1b1901bd..000000000
--- a/examples/wip/astro balls.js
+++ /dev/null
@@ -1,103 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- // game.load.image('arrow', 'assets/sprites/arrow.png');
- game.load.image('arrow', 'assets/sprites/thrust_ship2.png');
- game.load.image('chunk', 'assets/sprites/chunk.png');
- game.load.spritesheet('bullets', 'assets/sprites/balls.png', 17, 17);
-
-}
-
-var cannon;
-var bullets;
-var angle = 0;
-var fireRate = 100;
-var nextFire = 0;
-var cursors;
-
-function create() {
-
- game.stage.backgroundColor = '#2d2d2d';
-
- game.physics.gravity[1] = -8.5;
- game.physics.defaultRestitution = 0.8;
- game.physics.defaultFriction = 0.1;
-
- bullets = game.add.group();
- bullets.createMultiple(250, 'bullets', 0, false);
-
- cannon = game.add.sprite(50, 500, 'arrow');
- cannon.physicsEnabled = true;
- cannon.body.kinematic = true;
- cannon.body.mass = 4;
- cursors = game.input.keyboard.createCursorKeys();
-
-}
-
-function fire() {
-
- if (game.time.now > nextFire)
- {
- nextFire = game.time.now + fireRate;
-
- var bullet = bullets.getFirstExists(false);
-
- if (bullet)
- {
- bullet.frame = game.rnd.integerInRange(0,6);
- bullet.exists = true;
- bullet.position.set(cannon.x, cannon.y);
- bullet.physicsEnabled = true;
-
- bullet.body.rotation = cannon.rotation + game.math.degToRad(90);
-
- var magnitude = game.math.px2p(-500);
- var angle = bullet.body.rotation + Math.PI / 2;
-
- bullet.body.velocity.x = magnitude * Math.cos(angle);
- bullet.body.velocity.y = magnitude * Math.sin(angle);
- }
- }
-
-}
-
-function update() {
-
- if (cursors.left.isDown)
- {
- cannon.body.rotateLeft(100);
- }
- else if (cursors.right.isDown)
- {
- cannon.body.rotateRight(100);
- }
- else
- {
- cannon.body.setZeroRotation();
- }
-
- if (cursors.up.isDown)
- {
- cannon.body.moveForward(200);
- }
- else if (cursors.down.isDown)
- {
- cannon.body.moveBackward(200);
- }
-
- var dx = game.input.activePointer.worldX - cannon.x;
- var dy = game.input.activePointer.worldY - cannon.y;
- cannon.rotation = Math.atan2(dy, dx);
-
- if (game.input.activePointer.isDown)
- {
- fire();
- }
-
-}
-
-function render() {
-
-}
diff --git a/examples/wip/atari balls.js b/examples/wip/atari balls.js
deleted file mode 100644
index ea66d7d15..000000000
--- a/examples/wip/atari balls.js
+++ /dev/null
@@ -1,99 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('atari', 'assets/sprites/atari130xe.png');
- game.load.spritesheet('bullets', 'assets/sprites/balls.png', 17, 17);
-
-}
-
-var atari;
-var balls;
-
-function create() {
-
- game.stage.backgroundColor = '#2d2d2d';
-
- balls = game.add.group();
-
- balls.createMultiple(250, 'bullets', 0, false);
-
- atari = game.add.sprite(300, 450, 'atari');
-
- game.physics.arcade.gravity.y = 400;
-
- // Enable physics on everything added to the world so far (the true parameter makes it recurse down into children)
- game.physics.arcade.enable(game.world, true);
-
- atari.body.gravityScale.y = 0;
- atari.body.immovable = true;
-
- cursors = game.input.keyboard.createCursorKeys();
-
- game.time.events.loop(150, fire, this);
-
-}
-
-function fire() {
-
- var ball = balls.getFirstExists(false);
-
- if (ball)
- {
- ball.frame = game.rnd.integerInRange(0,6);
- ball.exists = true;
- ball.reset(game.world.randomX, 0);
-
- ball.body.bounce.y = 0.8;
- }
-
-}
-
-function reflect(a, ball) {
-
- if (ball.y > (atari.y + 5))
- {
- return true;
- }
- else
- {
- ball.body.velocity.x = atari.body.velocity.x;
- ball.body.velocity.y *= -(ball.body.bounce.y);
-
- return false;
- }
-
-}
-
-function update() {
-
- game.physics.arcade.collide(atari, balls, null, reflect, this);
-
- atari.body.velocity.x = 0;
-
- if (cursors.left.isDown)
- {
- atari.body.velocity.x = -200;
- }
- else if (cursors.right.isDown)
- {
- atari.body.velocity.x = 200;
- }
-
- balls.forEachAlive(checkBounds, this);
-
-}
-
-function checkBounds(ball) {
-
- if (ball.y > 600)
- {
- ball.kill();
- }
-
-}
-
-function render() {
-
-}
diff --git a/examples/wip/atlas_trim_array.js b/examples/wip/atlas_trim_array.js
deleted file mode 100644
index a3c09512d..000000000
--- a/examples/wip/atlas_trim_array.js
+++ /dev/null
@@ -1,24 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
-
-function preload() {
-
- // Non-trimmed
- // game.load.atlasJSONArray('atlas', 'assets/sprites/atlas_array_no_trim.png', 'assets/sprites/atlas_json_array_no_trim.json');
- // game.load.atlasJSONHash('atlas', 'assets/sprites/atlas_hash_no_trim.png', 'assets/sprites/atlas_json_hash_no_trim.json');
-
- // Trimmed
- // game.load.atlasJSONArray('atlas', 'assets/sprites/atlas_array_trim.png', 'assets/sprites/atlas_json_array_trim.json');
- game.load.atlasJSONHash('atlas', 'assets/sprites/atlas_hash_trim.png', 'assets/sprites/atlas_json_hash_trim.json');
-
-}
-
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(330, 100, 'atlas', 'nanoha_taiken_blue');
-
- sprite = game.add.sprite(530, 100, 'atlas', 'ladycop');
-
-}
diff --git a/examples/wip/autoscroll.js b/examples/wip/autoscroll.js
deleted file mode 100644
index ae0f4a8a1..000000000
--- a/examples/wip/autoscroll.js
+++ /dev/null
@@ -1,37 +0,0 @@
-
-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);
-
- game.add.image(200, 200, 'mummy');
-
- game.world.scale.set(2);
-
-}
-
-function update() {
-
-}
-
-function render() {
-
- // game.debug.text(sprite.frame, 32, 32);
-
-}
diff --git a/examples/wip/bitmaptext littera.js b/examples/wip/bitmaptext littera.js
deleted file mode 100644
index a2cacf457..000000000
--- a/examples/wip/bitmaptext littera.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
-
-function preload() {
-
- game.load.bitmapFont('shortStack', 'assets/fonts/bitmapFonts/shortStack.png', 'assets/fonts/bitmapFonts/shortStack.fnt');
-
-}
-
-function create() {
-
- game.add.bitmapText(32, 32, 'shortStack', 'This font was generated using the\nfree Littera web site\n\nhttp://kvazars.com/littera/', 32);
-
-}
diff --git a/examples/wip/bitmaptext1.js b/examples/wip/bitmaptext1.js
deleted file mode 100644
index 364fff96d..000000000
--- a/examples/wip/bitmaptext1.js
+++ /dev/null
@@ -1,35 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
-
-function preload() {
-
- game.load.bitmapFont('desyrel', 'assets/fonts/bitmapFonts/desyrel.png', 'assets/fonts/bitmapFonts/desyrel.xml', null, 0, -32);
- game.load.bitmapFont('carrier', 'assets/fonts/bitmapFonts/carrier_command.png', 'assets/fonts/bitmapFonts/carrier_command.xml', null, 0, 24);
-
-}
-
-var text;
-var text2;
-
-function create() {
-
- text = game.add.bitmapText(100, 100, 'carrier', 'Phaser and Pixi\nrocking!', 32);
-
- text2 = game.add.bitmapText(100, 300, 'desyrel', 'Phaser & Pixi\nrocking!', 64);
-
- game.input.onDown.add(change, this);
-
-}
-
-function change() {
-
- text.align = 'center';
- text2.tint = Math.random() * 0xFFFFFF;
-
-}
-
-function update() {
-
- // text.text = 'Phaser & Pixi\nrocking!\n' + Math.round(game.time.now);
-
-}
diff --git a/examples/wip/bitmaptext2.js b/examples/wip/bitmaptext2.js
deleted file mode 100644
index fc6f23b0a..000000000
--- a/examples/wip/bitmaptext2.js
+++ /dev/null
@@ -1,47 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
-
-function preload() {
-
- game.load.image('goldFont', 'assets/fonts/retroFonts/gold_font.png');
- game.load.image('bluePink', 'assets/fonts/retroFonts/bluepink_font.png');
- game.load.image('forgotten', 'assets/pics/forgotten_worlds.png');
-
-}
-
-var font1;
-var font2;
-var image1;
-var image2;
-
-function create() {
-
- font1 = game.add.retroFont('goldFont', 16, 16, "! :() ,?." + Phaser.RetroFont.TEXT_SET10, 20, 0, 0);
- font1.text = "phaser brings you retro style bitmap fonts";
-
- image1 = game.add.image(game.world.centerX, 48, font1);
- image1.anchor.set(0.5);
-
- font2 = game.add.retroFont('bluePink', 32, 32, Phaser.RetroFont.TEXT_SET2, 10);
- font2.setText("phaser 2\nin the house", true, 0, 8, Phaser.RetroFont.ALIGN_CENTER);
-
- image2 = game.add.image(game.world.centerX, 220, font2);
- image2.anchor.set(0.5);
-
- game.add.image(0, game.height - 274, 'forgotten');
-
- game.time.events.loop(Phaser.Timer.SECOND * 2, change, this);
-
-}
-
-function change() {
-
- image2.tint = Math.random() * 0xFFFFFF;
-
-}
-
-function update() {
-
- image2.rotation += (2 * game.time.physicsElapsed);
-
-}
diff --git a/examples/wip/bitmaptext3.js b/examples/wip/bitmaptext3.js
deleted file mode 100644
index 5f199adc9..000000000
--- a/examples/wip/bitmaptext3.js
+++ /dev/null
@@ -1,30 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
-
-function preload() {
-
- game.load.image('knightHawks', 'assets/fonts/retroFonts/KNIGHT3.png');
-
-}
-
-var font;
-
-function create() {
-
- font = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET6, 10, 1, 1);
- font.text = 'phaser was here';
-
- for (var c = 0; c < 19; c++)
- {
- var i = game.add.image(game.world.centerX, c * 32, font);
- i.tint = Math.random() * 0xFFFFFF;
- i.anchor.set(0.5, 1);
- }
-
-}
-
-function update() {
-
- font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
-
-}
diff --git a/examples/wip/blank text.js b/examples/wip/blank text.js
deleted file mode 100644
index 5e5077eb8..000000000
--- a/examples/wip/blank text.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create });
-
-function create() {
-
- var style = { font: "65px Arial", fill: "#ff0044", align: "center" };
- var text = game.add.text(game.world.centerX, game.world.centerY, "x", style);
-
- text.anchor.set(0.5);
-
-}
\ No newline at end of file
diff --git a/examples/wip/blendmodes.js b/examples/wip/blendmodes.js
deleted file mode 100644
index b8fc2a710..000000000
--- a/examples/wip/blendmodes.js
+++ /dev/null
@@ -1,62 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('bg', 'assets/pics/color_wheel_swirl.png');
- game.load.image('pic', 'assets/pics/questar.png');
- game.load.image('mask1', 'assets/pics/mask-test.png');
- game.load.image('mask2', 'assets/pics/mask-test2.png');
-
-}
-
-var pic;
-var mask;
-
-function create() {
-
- var bmd = game.make.bitmapData(320, 200);
-
- // bmd.draw('pic');
-
- bmd.alphaMask('pic', 'mask2');
-
- pic = game.add.sprite(0, 0, bmd);
-
- // game.add.image(-200, 0, 'bg');
-
- // mask = game.add.sprite(0, 0, 'mask1');
-
- // pic = game.add.sprite(0, 0, 'pic');
-
- // mask.addChild(pic);
-
- // pic.blendMode = Phaser.blendModes.NORMAL;
- // pic.blendMode = Phaser.blendModes.ADD;
- // pic.blendMode = Phaser.blendModes.MULTIPLY;
- // pic.blendMode = Phaser.blendModes.SCREEN;
- // mask.blendMode = Phaser.blendModes.OVERLAY;
- // pic.blendMode = Phaser.blendModes.DARKEN;
- // pic.blendMode = Phaser.blendModes.LIGHTEN;
- // pic.blendMode = Phaser.blendModes.COLOR_DODGE;
- // pic.blendMode = Phaser.blendModes.COLOR_BURN;
- // pic.blendMode = Phaser.blendModes.HARD_LIGHT;
- // pic.blendMode = Phaser.blendModes.SOFT_LIGHT;
- // pic.blendMode = Phaser.blendModes.DIFFERENCE;
- // pic.blendMode = Phaser.blendModes.EXCLUSION;
- // pic.blendMode = Phaser.blendModes.HUE;
- // pic.blendMode = PIXI.blendModes.SATURATION;
- // pic.blendMode = Phaser.blendModes.COLOR;
- // pic.blendMode = Phaser.blendModes.LUMINOSITY;
-
-}
-
-function update() {
-
-
-}
-
-function render() {
-
-}
diff --git a/examples/wip/bmd.js b/examples/wip/bmd.js
deleted file mode 100644
index 32e7be6ae..000000000
--- a/examples/wip/bmd.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('pic', '/phaser/examples/assets/pics/1984-nocooper-space.png');
-
-}
-
-var image;
-var bmd;
-
-function create() {
-
- console.log('pic box 11');
-
- game.add.sprite(0, 0, 'pic');
-
- bmd = game.add.bitmapData(800, 600);
- bmd.context.fillStyle = 'rgba(255,0,0,1)';
- bmd.context.fillRect(0, 0, 300, 100);
-
- image = game.add.image(0, 100, bmd);
-
-}
-
-function update() {
-
- bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
-
-}
-
-function render() {
-
- game.debug.text(game.input.x, 32, 32);
-
-}
diff --git a/examples/wip/book/audio/explode.wav b/examples/wip/book/audio/explode.wav
deleted file mode 100644
index 05cefd0c6..000000000
Binary files a/examples/wip/book/audio/explode.wav and /dev/null differ
diff --git a/examples/wip/book/audio/shot.wav b/examples/wip/book/audio/shot.wav
deleted file mode 100644
index 1ae178cba..000000000
Binary files a/examples/wip/book/audio/shot.wav and /dev/null differ
diff --git a/examples/wip/book/audio/title.mp3 b/examples/wip/book/audio/title.mp3
deleted file mode 100644
index 2a31b561a..000000000
Binary files a/examples/wip/book/audio/title.mp3 and /dev/null differ
diff --git a/examples/wip/book/fire.js b/examples/wip/book/fire.js
deleted file mode 100644
index 4cbdc5b25..000000000
--- a/examples/wip/book/fire.js
+++ /dev/null
@@ -1,96 +0,0 @@
-PIXI.FireFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- resolution: { type: 'f2', value: { x: width, y: height }},
- mouse: { type: 'f2', value: { x: 0, y: 0 }},
- time: { type: 'f', value: 1 }
- };
-
- // http://glsl.heroku.com/e#11707.0
-
- // Heroku shader conversion
- this.fragmentSrc = [
-
- "#ifdef GL_ES",
- "precision mediump float;",
- "#endif",
-
- "uniform float time;",
- "uniform vec2 mouse;",
- "uniform vec2 resolution;",
-
- "vec3 iResolution = vec3(resolution.x,resolution.y,100.);",
- "vec4 iMouse = vec4(mouse.x,mouse.y,5.,5.);",
- "float iGlobalTime = time;",
- "uniform sampler2D iChannel0;",
-
- "// by @301z",
-
- "float rand(vec2 n) {",
- "return fract(cos(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);",
- "}",
-
- "// Genera ruido en función de las coordenadas del pixel",
- "float noise(vec2 n) {",
- "const vec2 d = vec2(0.0, 1.0);",
- "vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));",
- "return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);",
- "}",
-
- "// Fractional Brownian Amplitude. Suma varias capas de ruido.",
- "float fbm(vec2 n) {",
- "float total = 0.0, amplitude = 1.0;",
- "for (int i = 0; i < 4; i++) {",
- "total += noise(n) * amplitude;",
- "n += n;",
- "amplitude *= 0.5;",
- "}",
- "return total;",
- "}",
-
- "void main() {",
- "// Colores",
- "const vec3 c1 = vec3(0.5, 0.0, 0.1); // Rojo oscuro.",
- "const vec3 c2 = vec3(0.9, 0.0, 0.0); // Rojo claro.",
- "const vec3 c3 = vec3(0.2, 0.0, 0.0); // Rojo oscuro.",
- "const vec3 c4 = vec3(1.0, 0.9, 0.0); // Amarillo.",
- "const vec3 c5 = vec3(0.1); // Gris oscuro.",
- "const vec3 c6 = vec3(0.9); // Gris claro.",
-
- "vec2 p = gl_FragCoord.xy * 8.0 / iResolution.xx; // Desfasa las coordenadas para que haya más cambio de un resultado a los colindantes.",
- "float q = fbm(p - iGlobalTime * 0.1); // Ruido con offset para el movimiento.",
- "vec2 r = vec2(fbm(p + q + iGlobalTime * 0.7 - p.x - p.y), fbm(p + q - iGlobalTime * 0.4));",
- "vec3 c = mix(c1, c2, fbm(p + r)) + mix(c3, c4, r.x) - mix(c5, c6, r.y);",
- "gl_FragColor = vec4(c *",
- "cos(1.57 * gl_FragCoord.y / iResolution.y), // Gradiente más ocuro arriba.",
- "1.0);",
- "}"];
-
-
-
-}
-
-PIXI.FireFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.FireFilter.prototype.constructor = PIXI.FireFilter;
-
-Object.defineProperty(PIXI.FireFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.time.value;
- },
- set: function(value) {
- this.uniforms.time.value = value;
- }
-});
diff --git a/examples/wip/book/images/bullet.png b/examples/wip/book/images/bullet.png
deleted file mode 100644
index ad04f6559..000000000
Binary files a/examples/wip/book/images/bullet.png and /dev/null differ
diff --git a/examples/wip/book/images/explode.png b/examples/wip/book/images/explode.png
deleted file mode 100644
index 0dd73247e..000000000
Binary files a/examples/wip/book/images/explode.png and /dev/null differ
diff --git a/examples/wip/book/images/invader32x32x4.png b/examples/wip/book/images/invader32x32x4.png
deleted file mode 100644
index 5d0409ccb..000000000
Binary files a/examples/wip/book/images/invader32x32x4.png and /dev/null differ
diff --git a/examples/wip/book/images/landscape.png b/examples/wip/book/images/landscape.png
deleted file mode 100644
index c34750eaa..000000000
Binary files a/examples/wip/book/images/landscape.png and /dev/null differ
diff --git a/examples/wip/book/images/logo.png b/examples/wip/book/images/logo.png
deleted file mode 100644
index ab34a5f77..000000000
Binary files a/examples/wip/book/images/logo.png and /dev/null differ
diff --git a/examples/wip/book/images/robofont.png b/examples/wip/book/images/robofont.png
deleted file mode 100644
index 5980813da..000000000
Binary files a/examples/wip/book/images/robofont.png and /dev/null differ
diff --git a/examples/wip/book/images/robofont.xml b/examples/wip/book/images/robofont.xml
deleted file mode 100644
index 095e141f0..000000000
--- a/examples/wip/book/images/robofont.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
- IMPORTANT: Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.
- * @property {boolean} active - * @default - */ - active: true, - - /** - * @method Phaser.Signal#validateListener - * @param {function} listener - Signal handler function. - * @param {Description} fnName - Description. - * @private - */ - validateListener: function (listener, fnName) { - if (typeof listener !== 'function') { - throw new Error( 'listener is a required param of {fn}() and should be a Function.'.replace('{fn}', fnName) ); - } - }, - - /** - * @method Phaser.Signal#_registerListener - * @param {function} listener - Signal handler function. - * @param {boolean} isOnce - Description. - * @param {object} [listenerContext] - Description. - * @param {number} [priority] - The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0). - * @return {Phaser.SignalBinding} An Object representing the binding between the Signal and listener. - * @private - */ - _registerListener: function (listener, isOnce, listenerContext, priority) { - - var prevIndex = this._indexOfListener(listener, listenerContext), - binding; - - if (prevIndex !== -1) { - binding = this._bindings[prevIndex]; - if (binding.isOnce() !== isOnce) { - throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.'); - } - } else { - binding = new Phaser.SignalBinding(this, listener, isOnce, listenerContext, priority); - this._addBinding(binding); - } - - if (this.memorize && this._prevParams){ - binding.execute(this._prevParams); - } - - return binding; - }, - - /** - * @method Phaser.Signal#_addBinding - * @param {Phaser.SignalBinding} binding - An Object representing the binding between the Signal and listener. - * @private - */ - _addBinding: function (binding) { - //simplified insertion sort - var n = this._bindings.length; - do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority); - this._bindings.splice(n + 1, 0, binding); - }, - - /** - * @method Phaser.Signal#_indexOfListener - * @param {function} listener - Signal handler function. - * @return {number} Description. - * @private - */ - _indexOfListener: function (listener, context) { - var n = this._bindings.length, - cur; - while (n--) { - cur = this._bindings[n]; - if (cur._listener === listener && cur.context === context) { - return n; - } - } - return -1; - }, - - /** - * Check if listener was attached to Signal. - * - * @method Phaser.Signal#has - * @param {Function} listener - Signal handler function. - * @param {Object} [context] - Context on which listener will be executed (object that should represent the `this` variable inside listener function). - * @return {boolean} If Signal has the specified listener. - */ - has: function (listener, context) { - return this._indexOfListener(listener, context) !== -1; - }, - - /** - * Add a listener to the signal. - * - * @method Phaser.Signal#add - * @param {function} listener - Signal handler function. - * @param {object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function). - * @param {number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0). - * @return {Phaser.SignalBinding} An Object representing the binding between the Signal and listener. - */ - add: function (listener, listenerContext, priority) { - this.validateListener(listener, 'add'); - return this._registerListener(listener, false, listenerContext, priority); - }, - - /** - * Add listener to the signal that should be removed after first execution (will be executed only once). - * - * @method Phaser.Signal#addOnce - * @param {function} listener Signal handler function. - * @param {object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function). - * @param {number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0) - * @return {Phaser.SignalBinding} An Object representing the binding between the Signal and listener. - */ - addOnce: function (listener, listenerContext, priority) { - this.validateListener(listener, 'addOnce'); - return this._registerListener(listener, true, listenerContext, priority); - }, - - /** - * Remove a single listener from the dispatch queue. - * - * @method Phaser.Signal#remove - * @param {function} listener Handler function that should be removed. - * @param {object} [context] Execution context (since you can add the same handler multiple times if executing in a different context). - * @return {function} Listener handler function. - */ - remove: function (listener, context) { - - this.validateListener(listener, 'remove'); - - var i = this._indexOfListener(listener, context); - - if (i !== -1) - { - this._bindings[i]._destroy(); //no reason to a Phaser.SignalBinding exist if it isn't attached to a signal - this._bindings.splice(i, 1); - } - - return listener; - - }, - - /** - * Remove all listeners from the Signal. - * - * @method Phaser.Signal#removeAll - */ - removeAll: function () { - var n = this._bindings.length; - while (n--) { - this._bindings[n]._destroy(); - } - this._bindings.length = 0; - }, - - /** - * Gets the total number of listeneres attached to ths Signal. - * - * @method Phaser.Signal#getNumListeners - * @return {number} Number of listeners attached to the Signal. - */ - getNumListeners: function () { - return this._bindings.length; - }, - - /** - * Stop propagation of the event, blocking the dispatch to next listeners on the queue. - *IMPORTANT: should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.
- * @see Signal.prototype.disable - * - * @method Phaser.Signal#halt - */ - halt: function () { - this._shouldPropagate = false; - }, - - /** - * Dispatch/Broadcast Signal to all listeners added to the queue. - * - * @method Phaser.Signal#dispatch - * @param {any} [params] - Parameters that should be passed to each handler. - */ - dispatch: function (params) { - if (! this.active) { - return; - } - - var paramsArr = Array.prototype.slice.call(arguments), - n = this._bindings.length, - bindings; - - if (this.memorize) { - this._prevParams = paramsArr; - } - - if (! n) { - //should come after memorize - return; - } - - bindings = this._bindings.slice(); //clone array in case add/remove items during dispatch - this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch. - - //execute all callbacks until end of the list or until a callback returns `false` or stops propagation - //reverse loop since listeners with higher priority will be added at the end of the list - do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false); - }, - - /** - * Forget memorized arguments. - * @see Signal.memorize - * - * @method Phaser.Signal#forget - */ - forget: function(){ - this._prevParams = null; - }, - - /** - * Remove all bindings from signal and destroy any reference to external objects (destroy Signal object). - *IMPORTANT: calling any method on the signal instance after calling dispose will throw errors.
- * - * @method Phaser.Signal#dispose - */ - dispose: function () { - this.removeAll(); - delete this._bindings; - delete this._prevParams; - }, - - /** - * - * @method Phaser.Signal#toString - * @return {string} String representation of the object. - */ - toString: function () { - return '[Phaser.Signal active:'+ this.active +' numListeners:'+ this.getNumListeners() +']'; - } - -}; - -/** -* @author Richard DaveyIf binding was added using `Signal.addOnce()` it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.
- * @method Phaser.SignalBinding#execute - * @param {array} [paramsArr] - Array of parameters that should be passed to the listener. - * @return {Description} Value returned by the listener. - */ - execute: function (paramsArr) { - - var handlerReturn, params; - - if (this.active && !!this._listener) - { - params = this.params? this.params.concat(paramsArr) : paramsArr; - handlerReturn = this._listener.apply(this.context, params); - - if (this._isOnce) - { - this.detach(); - } - } - - return handlerReturn; - - }, - - /** - * Detach binding from signal. - *alias to: @see mySignal.remove(myBinding.getListener());
- * @method Phaser.SignalBinding#detach
- * @return {function|null} Handler function bound to the signal or `null` if binding was previously detached.
- */
- detach: function () {
- return this.isBound() ? this._signal.remove(this._listener, this.context) : null;
- },
-
- /**
- * @method Phaser.SignalBinding#isBound
- * @return {boolean} True if binding is still bound to the signal and has a listener.
- */
- isBound: function () {
- return (!!this._signal && !!this._listener);
- },
-
- /**
- * @method Phaser.SignalBinding#isOnce
- * @return {boolean} If SignalBinding will only be executed once.
- */
- isOnce: function () {
- return this._isOnce;
- },
-
- /**
- * @method Phaser.SignalBinding#getListener
- * @return {Function} Handler function bound to the signal.
- */
- getListener: function () {
- return this._listener;
- },
-
- /**
- * @method Phaser.SignalBinding#getSignal
- * @return {Signal} Signal that listener is currently bound to.
- */
- getSignal: function () {
- return this._signal;
- },
-
- /**
- * @method Phaser.SignalBinding#_destroy
- * Delete instance properties
- * @private
- */
- _destroy: function () {
- delete this._signal;
- delete this._listener;
- delete this.context;
- },
-
- /**
- * @method Phaser.SignalBinding#toString
- * @return {string} String representation of the object.
- */
- toString: function () {
- return '[Phaser.SignalBinding isOnce:' + this._isOnce +', isBound:'+ this.isBound() +', active:' + this.active + ']';
- }
-
-};
-
-/**
-* @author Richard Davey
- * Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
- * of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.
- * max should be larger than min, or the function will return 0 Values must be positive integers, and are passed through Math.abs
- * The parameters allow you to specify the length, amplitude and frequency of the wave. Once you have called this function
- * you should get the results via getSinTable() and getCosTable(). This generator is fast enough to be used in real-time.
- * 0.){",
- "//It does, compute the distance camera-sphere",
- "float s=-b-sqrt(q);",
-
- "if(s Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ullamcorper ornare sagittis. Donec eleifend pulvinar velit nec convallis. Vestibulum vitae elit dui. Donec eu tincidunt sem. Duis lectus mi, bibendum sed nunc lobortis, tincidunt sollicitudin lectus. Aliquam erat volutpat. Aliquam a lectus sed tellus sodales tempus. Suspendisse potenti. Phasellus augue nisl, placerat vel sem vel, suscipit elementum neque. Vivamus tempor vestibulum eros, vitae mattis lectus aliquet ut. Curabitur interdum, nibh quis molestie placerat, augue ipsum commodo tortor, sed blandit est augue sit amet sapien. Ut vel consequat tellus. Aenean et vulputate sapien. Praesent rutrum elementum elit ut tempor. Aliquam erat volutpat. Fusce fermentum tincidunt est non vulputate. In aliquam sed nulla id luctus. Donec ut nibh massa. Nullam aliquam feugiat urna, nec ultricies risus vulputate at. Fusce scelerisque ligula vel urna porta, nec aliquam leo facilisis. Duis accumsan nibh vestibulum, venenatis enim sit amet, condimentum sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut auctor diam id mi porta, vestibulum pulvinar nibh sollicitudin. Curabitur ullamcorper lorem id lorem commodo, non ornare enim placerat. In vitae nisl lectus. Pellentesque eget neque sed ligula blandit porttitor vitae ut nibh. Nulla facilisi. Nunc ac erat viverra leo bibendum volutpat ut eu justo. Fusce a mollis purus. Phasellus consectetur vehicula ligula vel vestibulum. Suspendisse at dui vel ligula convallis lobortis at et tellus. Nullam aliquam erat eros, sit amet faucibus tortor iaculis ut. Sed ullamcorper dui sed dolor rutrum tincidunt. Ut sed faucibus mauris, non porta tellus. Nam ultricies vel leo eget rutrum. Sed sit amet pretium risus. Nunc ut sapien eget elit ultrices pretium quis sed justo. Donec a est vitae justo vestibulum porta. Ut interdum pharetra quam id tempor. Sed egestas placerat quam, quis ullamcorper dolor ornare non. Nulla et porttitor neque, a congue nisl. Maecenas vitae elit pretium odio euismod rhoncus. Nulla turpis libero, fermentum quis aliquet et, ultrices nec mi. Etiam vulputate, elit eu aliquet sagittis, sapien mi cursus nisi, vel mattis orci tortor non velit. Integer nisi dolor, posuere nec elit vitae, porttitor semper velit. Suspendisse sapien augue, lobortis sit amet dolor at, ornare porttitor metus. Proin venenatis ante nec augue volutpat dapibus. Sed interdum augue urna, id feugiat metus feugiat nec. In sed massa nisi. Donec iaculis nisi nulla, a pulvinar nisi dictum tristique. Nunc non erat enim. Proin consequat dolor nec leo gravida aliquet. Nulla non mollis turpis. Curabitur mollis tortor id elementum molestie. Maecenas eleifend et quam eget pellentesque. Integer ac hendrerit lorem. Nulla laoreet enim eget sem placerat, quis sagittis augue egestas. Ut porttitor purus rhoncus arcu dictum, id condimentum eros fringilla. Donec odio odio, lacinia sed ligula sit amet, viverra scelerisque libero. Curabitur pellentesque nulla mattis, egestas nibh non, viverra eros. Nullam volutpat lectus erat, quis luctus dui lobortis sit amet. Aenean ornare at sem vel pretium. Sed eu euismod nibh. Donec sed venenatis tortor.Phaser.Game
object.
-* @class Phaser.Game
-* @classdesc This is where the magic happens. The Game object is the heart of your game,
-* providing quick access to common functions and handling the boot process.
-* "Hell, there are no rules here - we're trying to accomplish something."
-* Thomas A. Edison
-* @constructor
-* @param {number} [width=800] - The width of your game in game pixels.
-* @param {number} [height=600] - The height of your game in game pixels.
-* @param {number} [renderer=Phaser.AUTO] - Which renderer to use (canvas or webgl)
-* @param {HTMLElement} [parent=''] - The Games DOM parent.
-* @param {any} [state=null] - Description.
-* @param {boolean} [transparent=false] - Use a transparent canvas background or not.
-* @param {boolean} [antialias=true] - Anti-alias graphics.
-*/
-Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias) {
-
- width = width || 800;
- height = height || 600;
- renderer = renderer || Phaser.AUTO;
- parent = parent || '';
- state = state || null;
-
- if (typeof transparent == 'undefined') { transparent = false; }
- if (typeof antialias == 'undefined') { antialias = true; }
-
- /**
- * @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
- */
- this.id = Phaser.GAMES.push(this) - 1;
-
- /**
- * @property {HTMLElement} parent - The Games DOM parent.
- */
- this.parent = parent;
-
- // Do some more intelligent size parsing here, so they can set "100%" for example, maybe pass the scale mode in here too?
-
- /**
- * @property {number} width - The Game width (in pixels).
- */
- this.width = width;
-
- /**
- * @property {number} height - The Game height (in pixels).
- */
- this.height = height;
-
- /**
- * @property {boolean} transparent - Use a transparent canvas background or not.
- */
- this.transparent = transparent;
-
- /**
- * @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
- */
- this.antialias = antialias;
-
- /**
- * @property {number} renderer - The Pixi Renderer
- * @default
- */
- this.renderer = null;
-
- /**
- * @property {number} state - The StateManager.
- */
- this.state = new Phaser.StateManager(this, state);
-
- /**
- * @property {boolean} _paused - Is game paused?
- * @private
- * @default
- */
- this._paused = false;
-
- /**
- * @property {number} renderType - The Renderer this Phaser.Game will use. Either Phaser.RENDERER_AUTO, Phaser.RENDERER_CANVAS or Phaser.RENDERER_WEBGL.
- */
- this.renderType = renderer;
-
- /**
- * @property {boolean} _loadComplete - Whether load complete loading or not.
- * @private
- * @default
- */
- this._loadComplete = false;
-
- /**
- * @property {boolean} isBooted - Whether the game engine is booted, aka available.
- * @default
- */
- this.isBooted = false;
-
- /**
- * @property {boolean} id -Is game running or paused?
- * @default
- */
- this.isRunning = false;
-
- /**
- * @property {Phaser.RequestAnimationFrame} raf - Automatically handles the core game loop via requestAnimationFrame or setTimeout
- * @default
- */
- this.raf = null;
-
- /**
- * @property {Phaser.GameObjectFactory} add - Reference to the GameObject Factory.
- * @default
- */
- this.add = null;
-
- /**
- * @property {Phaser.Cache} cache - Reference to the assets cache.
- * @default
- */
- this.cache = null;
-
- /**
- * @property {Phaser.Input} input - Reference to the input manager
- * @default
- */
- this.input = null;
-
- /**
- * @property {Phaser.Loader} load - Reference to the assets loader.
- * @default
- */
- this.load = null;
-
- /**
- * @property {Phaser.Math} math - Reference to the math helper.
- * @default
- */
- this.math = null;
-
- /**
- * @property {Phaser.Net} net - Reference to the network class.
- * @default
- */
- this.net = null;
-
- /**
- * @property {Phaser.SoundManager} sound - Reference to the sound manager.
- * @default
- */
- this.sound = null;
-
- /**
- * @property {Phaser.Stage} stage - Reference to the stage.
- * @default
- */
- this.stage = null;
-
- /**
- * @property {Phaser.TimeManager} time - Reference to game clock.
- * @default
- */
- this.time = null;
-
- /**
- * @property {Phaser.TweenManager} tweens - Reference to the tween manager.
- * @default
- */
- this.tweens = null;
-
- /**
- * @property {Phaser.World} world - Reference to the world.
- * @default
- */
- this.world = null;
-
- /**
- * @property {Phaser.Physics.PhysicsManager} physics - Reference to the physics manager.
- * @default
- */
- this.physics = null;
-
- /**
- * @property {Phaser.RandomDataGenerator} rnd - Instance of repeatable random data generator helper.
- * @default
- */
- this.rnd = null;
-
- /**
- * @property {Phaser.Device} device - Contains device information and capabilities.
- * @default
- */
- this.device = null;
-
- /**
- * @property {Phaser.Physics.PhysicsManager} camera - A handy reference to world.camera.
- * @default
- */
- this.camera = null;
-
- /**
- * @property {HTMLCanvasElement} canvas - A handy reference to renderer.view.
- * @default
- */
- this.canvas = null;
-
- /**
- * @property {Context} context - A handy reference to renderer.context (only set for CANVAS games)
- * @default
- */
- this.context = null;
-
- /**
- * @property {Phaser.Utils.Debug} debug - A set of useful debug utilitie.
- * @default
- */
- this.debug = null;
-
- /**
- * @property {Phaser.Particles} particles - The Particle Manager.
- * @default
- */
- this.particles = null;
-
- var _this = this;
-
- this._onBoot = function () {
- return _this.boot();
- }
-
- if (document.readyState === 'complete' || document.readyState === 'interactive')
- {
- window.setTimeout(this._onBoot, 0);
- }
- else
- {
- document.addEventListener('DOMContentLoaded', this._onBoot, false);
- window.addEventListener('load', this._onBoot, false);
- }
-
- return this;
-
-};
-
-Phaser.Game.prototype = {
-
- /**
- * Initialize engine sub modules and start the game.
- *
- * @method Phaser.Game#boot
- * @protected
- */
- boot: function () {
-
- if (this.isBooted)
- {
- return;
- }
-
- if (!document.body)
- {
- window.setTimeout(this._onBoot, 20);
- }
- else
- {
- document.removeEventListener('DOMContentLoaded', this._onBoot);
- window.removeEventListener('load', this._onBoot);
-
- this.onPause = new Phaser.Signal;
- this.onResume = new Phaser.Signal;
-
- this.isBooted = true;
-
- this.device = new Phaser.Device();
- this.math = Phaser.Math;
- this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]);
-
- this.stage = new Phaser.Stage(this, this.width, this.height);
-
- this.setUpRenderer();
-
- this.world = new Phaser.World(this);
- this.add = new Phaser.GameObjectFactory(this);
- this.cache = new Phaser.Cache(this);
- this.load = new Phaser.Loader(this);
- this.time = new Phaser.Time(this);
- this.tweens = new Phaser.TweenManager(this);
- this.input = new Phaser.Input(this);
- this.sound = new Phaser.SoundManager(this);
- this.physics = new Phaser.Physics.Arcade(this);
- this.particles = new Phaser.Particles(this);
- this.plugins = new Phaser.PluginManager(this, this);
- this.net = new Phaser.Net(this);
- this.debug = new Phaser.Utils.Debug(this);
-
- this.stage.boot();
- this.world.boot();
- this.input.boot();
- this.sound.boot();
- this.state.boot();
-
- this.load.onLoadComplete.add(this.loadComplete, this);
-
- this.showDebugHeader();
-
- this.isRunning = true;
- this._loadComplete = false;
-
- this.raf = new Phaser.RequestAnimationFrame(this);
- this.raf.start();
-
- }
-
- },
-
- /**
- * Displays a Phaser version debug header in the console.
- *
- * @method Phaser.Game#showDebugHeader
- * @protected
- */
- showDebugHeader: function () {
-
- var v = Phaser.DEV_VERSION;
- var r = 'Canvas';
- var a = 'HTML Audio';
-
- if (this.renderType == Phaser.WEBGL)
- {
- r = 'WebGL';
- }
-
- if (this.device.webAudio)
- {
- a = 'WebAudio';
- }
-
- if (this.device.chrome)
- {
- var args = [
- '%c %c %c Phaser v' + v + ' - Renderer: ' + r + ' - Audio: ' + a + ' %c %c ',
- 'background: #00bff3',
- 'background: #0072bc',
- 'color: #ffffff; background: #003471',
- 'background: #0072bc',
- 'background: #00bff3'
- ];
-
- console.log.apply(console, args);
- }
- else
- {
- console.log('Phaser v' + v + ' - Renderer: ' + r + ' - Audio: ' + a);
- }
-
- },
-
- /**
- * Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
- *
- * @method Phaser.Game#setUpRenderer
- * @protected
- */
- setUpRenderer: function () {
-
- if (this.renderType === Phaser.CANVAS || (this.renderType === Phaser.AUTO && this.device.webGL == false))
- {
- if (this.device.canvas)
- {
- this.renderType = Phaser.CANVAS;
- this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.stage.canvas, this.transparent);
- Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias);
- this.canvas = this.renderer.view;
- this.context = this.renderer.context;
- }
- else
- {
- throw new Error('Phaser.Game - cannot create Canvas or WebGL context, aborting.');
- }
- }
- else
- {
- // They requested WebGL, and their browser supports it
- this.renderType = Phaser.WEBGL;
- this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.stage.canvas, this.transparent, this.antialias);
- this.canvas = this.renderer.view;
- this.context = null;
- }
-
- Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true);
- Phaser.Canvas.setTouchAction(this.renderer.view);
-
- },
-
- /**
- * Called when the load has finished, after preload was run.
- *
- * @method Phaser.Game#loadComplete
- * @protected
- */
- loadComplete: function () {
-
- this._loadComplete = true;
-
- this.state.loadComplete();
-
- },
-
- /**
- * The core game loop.
- *
- * @method Phaser.Game#update
- * @protected
- * @param {number} time - The current time as provided by RequestAnimationFrame.
- */
- update: function (time) {
-
- this.time.update(time);
-
- if (this._paused)
- {
- this.renderer.render(this.stage._stage);
- this.plugins.render();
- this.state.render();
- }
- else
- {
- this.plugins.preUpdate();
- this.physics.preUpdate();
-
- this.stage.update();
- this.input.update();
- this.tweens.update();
- this.sound.update();
- this.world.update();
- this.particles.update();
- this.state.update();
- this.plugins.update();
-
- this.world.postUpdate();
- this.plugins.postUpdate();
-
- this.renderer.render(this.stage._stage);
- this.plugins.render();
- this.state.render();
-
- this.plugins.postRender();
- }
-
- },
-
- /**
- * Nuke the entire game from orbit
- *
- * @method Phaser.Game#destroy
- */
- destroy: function () {
-
- this.raf.stop();
-
- this.input.destroy();
-
- this.state.destroy();
-
- this.state = null;
- this.cache = null;
- this.input = null;
- this.load = null;
- this.sound = null;
- this.stage = null;
- this.time = null;
- this.world = null;
- this.isBooted = false;
-
- }
-
-};
-
-/**
-* The paused state of the Game. A paused game doesn't update any of its subsystems.
-* When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched.
-* @name Phaser.Game#paused
-* @property {boolean} paused - Gets and sets the paused state of the Game.
-*/
-Object.defineProperty(Phaser.Game.prototype, "paused", {
-
- get: function () {
- return this._paused;
- },
-
- set: function (value) {
-
- if (value === true)
- {
- if (this._paused == false)
- {
- this._paused = true;
- this.onPause.dispatch(this);
- }
- }
- else
- {
- if (this._paused)
- {
- this._paused = false;
- this.onResume.dispatch(this);
- }
- }
-
- }
-
-});
-
-/**
-* "Deleted code is debugged code." - Jeff Sickel
-*/
-
-/**
-* @author Richard Davey TileSprite
.
- *
- * @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 {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.
- * @return {Phaser.TileSprite} The newly created tileSprite object.
- */
- tileSprite: function (x, y, width, height, key, frame) {
-
- return this.world.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame));
-
- },
-
- /**
- * Creates a new Text
.
- *
- * @method Phaser.GameObjectFactory#text
- * @param {number} x - X position of the new text object.
- * @param {number} y - Y position of the new text object.
- * @param {string} text - The actual text that will be written.
- * @param {object} style - The style object containing style attributes like font, font size , etc.
- * @return {Phaser.Text} The newly created text object.
- */
- text: function (x, y, text, style) {
-
- return this.world.add(new Phaser.Text(this.game, x, y, text, style));
-
- },
-
- /**
- * Creates a new Button
object.
- *
- * @method Phaser.GameObjectFactory#button
- * @param {number} [x] X position of the new button object.
- * @param {number} [y] Y position of the new button object.
- * @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
- * @param {function} [callback] The function to call when this button is pressed
- * @param {object} [callbackContext] The context in which the callback will be called (usually 'this')
- * @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
- * @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
- * @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
- * @return {Phaser.Button} The newly created button object.
- */
- button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) {
-
- return this.world.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
-
- },
-
- /**
- * Creates a new Graphics
object.
- *
- * @method Phaser.GameObjectFactory#graphics
- * @param {number} x - X position of the new graphics object.
- * @param {number} y - Y position of the new graphics object.
- * @return {Phaser.Graphics} The newly created graphics object.
- */
- graphics: function (x, y) {
-
- return this.world.add(new Phaser.Graphics(this.game, x, y));
-
- },
-
- /**
- * Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
- * continuous effects like rain and fire. All it really does is launch Particle objects out
- * at set intervals, and fixes their positions and velocities accorindgly.
- *
- * @method Phaser.GameObjectFactory#emitter
- * @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
- * @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
- * @param {number} [maxParticles=50] - The total number of particles in this emitter.
- * @return {Phaser.Emitter} The newly created emitter object.
- */
- emitter: function (x, y, maxParticles) {
-
- return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles));
-
- },
-
- /**
- * * Create a new BitmapText
.
- *
- * @method Phaser.GameObjectFactory#bitmapText
- * @param {number} x - X position of the new bitmapText object.
- * @param {number} y - Y position of the new bitmapText object.
- * @param {string} text - The actual text that will be written.
- * @param {object} style - The style object containing style attributes like font, font size , etc.
- * @return {Phaser.BitmapText} The newly created bitmapText object.
- */
- bitmapText: function (x, y, text, style) {
-
- return this.world.add(new Phaser.BitmapText(this.game, x, y, text, style));
-
- },
-
- /**
- * Creates a new Tilemap object.
- *
- * @method Phaser.GameObjectFactory#tilemap
- * @param {string} key - Asset key for the JSON file.
- * @return {Phaser.Tilemap} The newly created tilemap object.
- */
- tilemap: function (key) {
-
- return new Phaser.Tilemap(this.game, key);
-
- },
-
- /**
- * Creates a new Tileset object.
- *
- * @method Phaser.GameObjectFactory#tileset
- * @param {string} key - The image key as defined in the Game.Cache to use as the tileset.
- * @return {Phaser.Tileset} The newly created tileset object.
- */
- tileset: function (key) {
-
- return this.game.cache.getTileset(key);
-
- },
-
- /**
- * Creates a new Tilemap Layer object.
- *
- * @method Phaser.GameObjectFactory#tilemapLayer
- * @param {number} x - X position of the new tilemapLayer.
- * @param {number} y - Y position of the new tilemapLayer.
- * @param {number} width - the width of the tilemapLayer.
- * @param {number} height - the height of the tilemapLayer.
- * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
- */
- tilemapLayer: function (x, y, width, height, tileset, tilemap, layer) {
-
- return this.world.add(new Phaser.TilemapLayer(this.game, x, y, width, height, tileset, tilemap, layer));
-
- },
-
- /**
- * A dynamic initially blank canvas to which images can be drawn.
- *
- * @method Phaser.GameObjectFactory#renderTexture
- * @param {string} key - Asset key for the render texture.
- * @param {number} width - the width of the render texture.
- * @param {number} height - the height of the render texture.
- * @return {Phaser.RenderTexture} The newly created renderTexture object.
- */
- renderTexture: function (key, width, height) {
-
- var texture = new Phaser.RenderTexture(this.game, key, width, height);
-
- this.game.cache.addRenderTexture(key, texture);
-
- return texture;
-
- },
-
- /**
- * A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
- *
- * @method Phaser.GameObjectFactory#bitmapData
- * @param {number} [width=256] - The width of the BitmapData in pixels.
- * @param {number} [height=256] - The height of the BitmapData in pixels.
- * @return {Phaser.BitmapData} The newly created BitmapData object.
- */
- bitmapData: function (width, height) {
-
- return new Phaser.BitmapData(this.game, width, height);
-
- },
-
- /**
- * A WebGL shader/filter that can be applied to Sprites.
- *
- * @method Phaser.GameObjectFactory#filter
- * @param {string} filter - The name of the filter you wish to create, for example "HueRotate" or "SineWave"
- * @param {...} - Whatever parameters are needed to be passed to the filter init function.
- * @return {Phaser.Filter} The newly created Phaser.Filter object.
- */
- filter: function (filter) {
-
- var args = Array.prototype.splice.call(arguments, 1);
-
- var f = new Phaser.Filter[filter](this.game);
-
- f.init.apply(f, args);
-
- return f;
-
- }
-
-};
-/**
-* @author Richard Davey TileSprite
.
-* @class Phaser.Tilemap
-* @constructor
-* @param {Phaser.Game} game - Current game instance.
-* @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 {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 = 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;
-
- Phaser.Sprite.call(this, game, x, y, key, frame);
-
- /**
- * @property {Description} texture - Description.
- */
- this.texture = PIXI.TextureCache[key];
-
- PIXI.TilingSprite.call(this, this.texture, width, height);
-
- /**
- * @property {Description} type - Description.
- */
- this.type = Phaser.TILESPRITE;
-
- /**
- * @property {Point} tileScale - The scaling of the image that is being tiled.
- */
- this.tileScale = new Phaser.Point(1, 1);
-
- /**
- * @property {Point} tilePosition - The offset position of the image that is being tiled.
- */
- this.tilePosition = new Phaser.Point(0, 0);
-
-};
-
-Phaser.TileSprite.prototype = Phaser.Utils.extend(true, PIXI.TilingSprite.prototype, Phaser.Sprite.prototype);
-Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
-
-// Add our own custom methods
-
-/**
-* @author Richard Davey Text
.
-* @class Phaser.Text
-* @constructor
-* @param {Phaser.Game} game - Current game instance.
-* @param {number} x - X position of the new text object.
-* @param {number} y - Y position of the new text object.
-* @param {string} text - The actual text that will be written.
-* @param {object} style - The style object containing style attributes like font, font size ,
-*/
-Phaser.Text = function (game, x, y, text, style) {
-
- x = x || 0;
- y = y || 0;
- text = text || '';
- style = style || '';
-
- // If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all
- /**
- * @property {boolean} exists - Description.
- * @default
- */
- this.exists = true;
-
- // This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering
- /**
- * @property {boolean} alive - Description.
- * @default
- */
- this.alive = true;
-
- /**
- * @property {Description} group - Description.
- * @default
- */
- this.group = null;
-
- /**
- * @property {string} name - Description.
- * @default
- */
- this.name = '';
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running game.
- */
- this.game = game;
-
- this._text = text;
- this._style = style;
-
- PIXI.Text.call(this, text, style);
-
- /**
- * @property {Description} type - Description.
- */
- this.type = Phaser.TEXT;
-
- /**
- * @property {Description} position - Description.
- */
- this.position.x = this.x = x;
- this.position.y = this.y = y;
-
- // Replaces the PIXI.Point with a slightly more flexible one
- /**
- * @property {Phaser.Point} anchor - Description.
- */
- this.anchor = new Phaser.Point();
-
- /**
- * @property {Phaser.Point} scale - Description.
- */
- this.scale = new Phaser.Point(1, 1);
-
- // A mini cache for storing all of the calculated values
- /**
- * @property {Description} _cache - Description.
- * @private
- */
- this._cache = {
-
- dirty: false,
-
- // Transform cache
- a00: 1, a01: 0, a02: x, a10: 0, a11: 1, a12: y, id: 1,
-
- // The previous calculated position
- x: -1, y: -1,
-
- // The actual scale values based on the worldTransform
- scaleX: 1, scaleY: 1
-
- };
-
- this._cache.x = this.x;
- this._cache.y = this.y;
-
- /**
- * @property {boolean} renderable - Description.
- */
- this.renderable = true;
-
-};
-
-Phaser.Text.prototype = Object.create(PIXI.Text.prototype);
-Phaser.Text.prototype.constructor = Phaser.Text;
-
-/**
-* Automatically called by World.update.
-* @method Phaser.Text.prototype.update
-*/
-Phaser.Text.prototype.update = function() {
-
- if (!this.exists)
- {
- return;
- }
-
- this._cache.dirty = false;
-
- this._cache.x = this.x;
- this._cache.y = this.y;
-
- if (this.position.x != this._cache.x || this.position.y != this._cache.y)
- {
- this.position.x = this._cache.x;
- this.position.y = this._cache.y;
- this._cache.dirty = true;
- }
-
-}
-
-/**
-* @method Phaser.Text.prototype.destroy
-*/
-Phaser.Text.prototype.destroy = function() {
-
- if (this.group)
- {
- this.group.remove(this);
- }
-
- if (this.canvas.parentNode)
- {
- this.canvas.parentNode.removeChild(this.canvas);
- }
- else
- {
- this.canvas = null;
- this.context = null;
- }
-
- this.exists = false;
-
- this.group = null;
-
-}
-
-/**
-* Get
-* @returns {Description}
-*//**
-* Set
-* @param {Description} value - Description
-*/
-Object.defineProperty(Phaser.Text.prototype, 'angle', {
-
- get: function() {
- return Phaser.Math.radToDeg(this.rotation);
- },
-
- set: function(value) {
- this.rotation = Phaser.Math.degToRad(value);
- }
-
-});
-
-Object.defineProperty(Phaser.Text.prototype, 'content', {
-
- get: function() {
- return this._text;
- },
-
- set: function(value) {
-
- // Let's not update unless needed, this way we can safely update the text in a core loop without constant re-draws
- if (value !== this._text)
- {
- this._text = value;
- this.setText(value);
- }
-
- }
-
-});
-
-Object.defineProperty(Phaser.Text.prototype, 'font', {
-
- get: function() {
- return this._style;
- },
-
- set: function(value) {
-
- // Let's not update unless needed, this way we can safely update the text in a core loop without constant re-draws
- if (value !== this._style)
- {
- this._style = value;
- this.setStyle(value);
- }
-
- }
-
-});
-
-/**
-* @author Richard Davey Graphics
object.
-*
-* @class Phaser.Graphics
-* @constructor
-*
-* @param {Phaser.Game} game Current game instance.
-* @param {number} x - X position of the new graphics object.
-* @param {number} y - Y position of the new graphics object.
-*/
-Phaser.Graphics = function (game, x, y) {
-
- this.game = game;
-
- PIXI.Graphics.call(this);
-
- /**
- * @property {Description} type - Description.
- */
- this.type = Phaser.GRAPHICS;
-
- this.position.x = x;
- this.position.y = y;
-
-};
-
-Phaser.Graphics.prototype = Object.create(PIXI.Graphics.prototype);
-Phaser.Graphics.prototype.constructor = Phaser.Graphics;
-
-// Add our own custom methods
-
-/**
-* Description.
-*
-* @method Phaser.Sprite.prototype.destroy
-*/
-Phaser.Graphics.prototype.destroy = function() {
-
- this.clear();
-
- if (this.group)
- {
- this.group.remove(this);
- }
-
- this.game = null;
-
-}
-
-/*
-* Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled
-*/
-Phaser.Graphics.prototype.drawPolygon = function (poly) {
-
- graphics.moveTo(poly.points[0].x, poly.points[0].y);
-
- for (var i = 1; i < poly.points.length; i += 1)
- {
- graphics.lineTo(poly.points[i].x, poly.points[i].y);
- }
-
- graphics.lineTo(poly.points[0].x, poly.points[0].y);
-
-}
-
-Object.defineProperty(Phaser.Graphics.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));
- }
-
-});
-
-Object.defineProperty(Phaser.Graphics.prototype, 'x', {
-
- get: function() {
- return this.position.x;
- },
-
- set: function(value) {
- this.position.x = value;
- }
-
-});
-
-Object.defineProperty(Phaser.Graphics.prototype, 'y', {
-
- get: function() {
- return this.position.y;
- },
-
- set: function(value) {
- this.position.y = value;
- }
-
-});
-
-/**
-* @author Richard Davey
- * Should be called whenever the angle is updated on the Sprite to stop it from going insane.
- *
- * @method Phaser.Math#wrapAngle
- * @param {number} angle - The angle value to check
- * @return {number} The new angle value, returns the same as the input angle if it was within bounds.
- */
- wrapAngle: function (angle) {
-
- var result = angle;
-
- // Nothing needs to change
- if (angle >= -180 && angle <= 180)
- {
- return angle;
- }
-
- // Else normalise it to -180, 180
- result = (angle + 180) % 360;
-
- if (result < 0)
- {
- result += 360;
- }
-
- return result - 180;
-
- },
-
- /**
- * Keeps an angle value between the given min and max values.
- *
- * @method Phaser.Math#angleLimit
- * @param {number} angle - The angle value to check. Must be between -180 and +180.
- * @param {number} min - The minimum angle that is allowed (must be -180 or greater).
- * @param {number} max - The maximum angle that is allowed (must be 180 or less).
- *
- * @return {number} The new angle value, returns the same as the input angle if it was within bounds
- */
- angleLimit: function (angle, min, max) {
-
- var result = angle;
-
- if (angle > max)
- {
- result = max;
- }
- else if (angle < min)
- {
- result = min;
- }
-
- return result;
-
- },
-
- /**
- * Description.
- * @method Phaser.Math#linearInterpolation
- * @param {number} v
- * @param {number} k
- * @return {number}
- */
- linearInterpolation: function (v, k) {
-
- var m = v.length - 1;
- var f = m * k;
- var i = Math.floor(f);
-
- if (k < 0)
- {
- return this.linear(v[0], v[1], f);
- }
-
- if (k > 1)
- {
- return this.linear(v[m], v[m - 1], m - f);
- }
-
- return this.linear(v[i], v[i + 1 > m ? m : i + 1], f - i);
-
- },
-
- /**
- * Description.
- * @method Phaser.Math#bezierInterpolation
- * @param {number} v
- * @param {number} k
- * @return {number}
- */
- bezierInterpolation: function (v, k) {
-
- var b = 0;
- var n = v.length - 1;
-
- for (var i = 0; i <= n; i++)
- {
- b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * this.bernstein(n, i);
- }
-
- return b;
-
- },
-
- /**
- * Description.
- * @method Phaser.Math#catmullRomInterpolation
- * @param {number} v
- * @param {number} k
- * @return {number}
- */
- catmullRomInterpolation: function (v, k) {
-
- var m = v.length - 1;
- var f = m * k;
- var i = Math.floor(f);
-
- if (v[0] === v[m])
- {
- if (k < 0)
- {
- i = Math.floor(f = m * (1 + k));
- }
-
- return this.catmullRom(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
-
- }
- else
- {
- if (k < 0)
- {
- return v[0] - (this.catmullRom(v[0], v[0], v[1], v[1], -f) - v[0]);
- }
-
- if (k > 1)
- {
- return v[m] - (this.catmullRom(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
- }
-
- return this.catmullRom(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
- }
-
- },
-
- /**
- * Description.
- * @method Phaser.Math#Linear
- * @param {number} p0
- * @param {number} p1
- * @param {number} t
- * @return {number}
- */
- linear: function (p0, p1, t) {
- return (p1 - p0) * t + p0;
- },
-
- /**
- * @method Phaser.Math#bernstein
- * @param {number} n
- * @param {number} i
- * @return {number}
- */
- bernstein: function (n, i) {
- return this.factorial(n) / this.factorial(i) / this.factorial(n - i);
- },
-
- /**
- * Description.
- * @method Phaser.Math#catmullRom
- * @param {number} p0
- * @param {number} p1
- * @param {number} p2
- * @param {number} p3
- * @param {number} t
- * @return {number}
- */
- catmullRom: function (p0, p1, p2, p3, t) {
-
- var v0 = (p2 - p0) * 0.5, v1 = (p3 - p1) * 0.5, t2 = t * t, t3 = t * t2;
-
- return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
-
- },
-
- /**
- * @method Phaser.Math#difference
- * @param {number} a
- * @param {number} b
- * @return {number}
- */
- difference: function (a, b) {
- return Math.abs(a - b);
- },
-
- /**
- * Fetch a random entry from the given array.
- * Will return null if random selection is missing, or array has no entries.
- *
- * @method Phaser.Math#getRandom
- * @param {array} objects - An array of objects.
- * @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array.
- * @param {number} length - Optional restriction on the number of values you want to randomly select from.
- * @return {object} The random object that was selected.
- */
- getRandom: function (objects, startIndex, length) {
-
- if (typeof startIndex === "undefined") { startIndex = 0; }
- if (typeof length === "undefined") { length = 0; }
-
- if (objects != null) {
-
- var l = length;
-
- if ((l == 0) || (l > objects.length - startIndex))
- {
- l = objects.length - startIndex;
- }
-
- if (l > 0)
- {
- return objects[startIndex + Math.floor(Math.random() * l)];
- }
- }
-
- return null;
-
- },
-
- /**
- * Round down to the next whole number. E.g. floor(1.7) == 1, and floor(-2.7) == -2.
- *
- * @method Phaser.Math#floor
- * @param {number} Value Any number.
- * @return {number} The rounded value of that number.
- */
- floor: function (value) {
-
- var n = value | 0;
-
- return (value > 0) ? (n) : ((n != value) ? (n - 1) : (n));
-
- },
-
- /**
- * Round up to the next whole number. E.g. ceil(1.3) == 2, and ceil(-2.3) == -3.
- *
- * @method Phaser.Math#ceil
- * @param {number} value - Any number.
- * @return {number} The rounded value of that number.
- */
- ceil: function (value) {
- var n = value | 0;
- return (value > 0) ? ((n != value) ? (n + 1) : (n)) : (n);
- },
-
- /**
- * Generate a sine and cosine table simultaneously and extremely quickly. Based on research by Franky of scene.at
- * Tween
.
-*
-* @class Phaser.Tween
-* @constructor
-* @param {object} object - Target object will be affected by this tween.
-* @param {Phaser.Game} game - Current game instance.
-*/
-Phaser.Tween = function (object, game) {
-
- /**
- * Reference to the target object.
- * @property {object} _object
- * @private
- */
- this._object = object;
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running Game.
- */
- this.game = game;
-
- /**
- * @property {object} _manager - Description.
- * @private
- */
- this._manager = this.game.tweens;
-
- /**
- * @property {object} _valuesStart - Description.
- * @private
- */
- this._valuesStart = {};
-
- /**
- * @property {object} _valuesEnd - Description.
- * @private
- */
- this._valuesEnd = {};
-
- /**
- * @property {object} _valuesStartRepeat - Description.
- * @private
- */
- this._valuesStartRepeat = {};
-
- /**
- * @property {number} _duration - Description.
- * @private
- * @default
- */
- this._duration = 1000;
-
- /**
- * @property {number} _repeat - Description.
- * @private
- * @default
- */
- this._repeat = 0;
-
- /**
- * @property {boolean} _yoyo - Description.
- * @private
- * @default
- */
- this._yoyo = false;
-
- /**
- * @property {boolean} _reversed - Description.
- * @private
- * @default
- */
- this._reversed = false;
-
- /**
- * @property {number} _delayTime - Description.
- * @private
- * @default
- */
- this._delayTime = 0;
-
- /**
- * @property {Description} _startTime - Description.
- * @private
- * @default null
- */
- this._startTime = null;
-
- /**
- * @property {Description} _easingFunction - Description.
- * @private
- */
- this._easingFunction = Phaser.Easing.Linear.None;
-
- /**
- * @property {Description} _interpolationFunction - Description.
- * @private
- */
- this._interpolationFunction = Phaser.Math.linearInterpolation;
-
- /**
- * @property {Description} _chainedTweens - Description.
- * @private
- */
- this._chainedTweens = [];
-
- /**
- * @property {Description} _onStartCallback - Description.
- * @private
- * @default
- */
- this._onStartCallback = null;
-
- /**
- * @property {boolean} _onStartCallbackFired - Description.
- * @private
- * @default
- */
- this._onStartCallbackFired = false;
-
- /**
- * @property {Description} _onUpdateCallback - Description.
- * @private
- * @default null
- */
- this._onUpdateCallback = null;
-
- /**
- * @property {Description} _onCompleteCallback - Description.
- * @private
- * @default null
- */
- this._onCompleteCallback = null;
-
- /**
- * @property {number} _pausedTime - Description.
- * @private
- * @default
- */
- this._pausedTime = 0;
-
- /**
- * @property {boolean} pendingDelete - If this tween is ready to be deleted by the TweenManager.
- * @default
- */
- this.pendingDelete = false;
-
- // Set all starting values present on the target object
- for ( var field in object ) {
- this._valuesStart[ field ] = parseFloat(object[field], 10);
- }
-
- /**
- * @property {Phaser.Signal} onStart - Description.
- */
- this.onStart = new Phaser.Signal();
-
- /**
- * @property {Phaser.Signal} onComplete - Description.
- */
- this.onComplete = new Phaser.Signal();
-
- /**
- * @property {boolean} isRunning - Description.
- * @default
- */
- this.isRunning = false;
-
-};
-
-Phaser.Tween.prototype = {
-
- /**
- * Configure the Tween
- *
- * @method Phaser.Tween#to
- * @param {object} properties - Properties you want to tween.
- * @param {number} duration - Duration of this tween.
- * @param {function} ease - Easing function.
- * @param {boolean} autoStart - Whether this tween will start automatically or not.
- * @param {number} delay - Delay before this tween will start, defaults to 0 (no delay).
- * @param {boolean} repeat - Should the tween automatically restart once complete? (ignores any chained tweens).
- * @param {Phaser.Tween} yoyo - Description.
- * @return {Phaser.Tween} Itself.
- */
- to: function ( properties, duration, ease, autoStart, delay, repeat, yoyo ) {
-
- duration = duration || 1000;
- ease = ease || null;
- autoStart = autoStart || false;
- delay = delay || 0;
- repeat = repeat || 0;
- yoyo = yoyo || false;
-
- var self;
- if (this._parent)
- {
- self = this._manager.create(this._object);
- this._lastChild.chain(self);
- this._lastChild = self;
- }
- else
- {
- self = this;
- this._parent = this;
- this._lastChild = this;
- }
-
- self._repeat = repeat;
- self._duration = duration;
- self._valuesEnd = properties;
-
- if (ease !== null)
- {
- self._easingFunction = ease;
- }
-
- if (delay > 0)
- {
- self._delayTime = delay;
- }
-
- self._yoyo = yoyo;
-
- if (autoStart) {
- return this.start();
- } else {
- return this;
- }
-
- },
-
- /**
- * Starts the tween running. Can also be called by the autoStart parameter of Tween.to.
- *
- * @method Phaser.Tween#start
- * @param {number} time - Description.
- * @return {Phaser.Tween} Itself.
- */
- start: function ( time ) {
-
- if (this.game === null || this._object === null) {
- return;
- }
-
- this._manager.add(this);
-
- this.onStart.dispatch(this._object);
-
- this.isRunning = true;
-
- this._onStartCallbackFired = false;
-
- this._startTime = this.game.time.now + this._delayTime;
-
- for ( var property in this._valuesEnd ) {
-
- // check if an Array was provided as property value
- if ( this._valuesEnd[ property ] instanceof Array ) {
-
- if ( this._valuesEnd[ property ].length === 0 ) {
-
- continue;
-
- }
-
- // create a local copy of the Array with the start value at the front
- this._valuesEnd[ property ] = [ this._object[ property ] ].concat( this._valuesEnd[ property ] );
-
- }
-
- this._valuesStart[ property ] = this._object[ property ];
-
- if ( ( this._valuesStart[ property ] instanceof Array ) === false ) {
- this._valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings
- }
-
- this._valuesStartRepeat[ property ] = this._valuesStart[ property ] || 0;
-
- }
-
- return this;
-
- },
-
- /**
- * Stops the tween if running and removes it from the TweenManager. If there are any onComplete callbacks or events they are not dispatched.
- *
- * @method Phaser.Tween#stop
- * @return {Phaser.Tween} Itself.
- */
- stop: function () {
-
- this.isRunning = false;
-
- this._manager.remove(this);
-
- return this;
-
- },
-
- /**
- * Sets a delay time before this tween will start.
- *
- * @method Phaser.Tween#delay
- * @param {number} amount - The amount of the delay in ms.
- * @return {Phaser.Tween} Itself.
- */
- delay: function ( amount ) {
-
- this._delayTime = amount;
- return this;
-
- },
-
- /**
- * Sets the number of times this tween will repeat.
- *
- * @method Phaser.Tween#repeat
- * @param {number} times - How many times to repeat.
- * @return {Phaser.Tween} Itself.
- */
- repeat: function ( times ) {
-
- this._repeat = times;
- return this;
-
- },
-
- /**
- * A tween that has yoyo set to true will run through from start to finish, then reverse from finish to start.
- * Used in combination with repeat you can create endless loops.
- *
- * @method Phaser.Tween#yoyo
- * @param {boolean} yoyo - Set to true to yoyo this tween.
- * @return {Phaser.Tween} Itself.
- */
- yoyo: function( yoyo ) {
-
- this._yoyo = yoyo;
- return this;
-
- },
-
- /**
- * Set easing function this tween will use, i.e. Phaser.Easing.Linear.None.
- *
- * @method Phaser.Tween#easing
- * @param {function} easing - The easing function this tween will use, i.e. Phaser.Easing.Linear.None.
- * @return {Phaser.Tween} Itself.
- */
- easing: function ( easing ) {
-
- this._easingFunction = easing;
- return this;
-
- },
-
- /**
- * Set interpolation function the tween will use, by default it uses Phaser.Math.linearInterpolation.
- *
- * @method Phaser.Tween#interpolation
- * @param {function} interpolation - The interpolation function to use (Phaser.Math.linearInterpolation by default)
- * @return {Phaser.Tween} Itself.
- */
- interpolation: function ( interpolation ) {
-
- this._interpolationFunction = interpolation;
- return this;
-
- },
-
- /**
- * You can chain tweens together by passing a reference to the chain function. This enables one tween to call another on completion.
- * You can pass as many tweens as you like to this function, they will each be chained in sequence.
- *
- * @method Phaser.Tween#chain
- * @return {Phaser.Tween} Itself.
- */
- chain: function () {
-
- this._chainedTweens = arguments;
- return this;
-
- },
-
- /**
- * Loop a chain of tweens
- *
- * Usage:
- * game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
- * .to({ y: 300 }, 1000, Phaser.Easing.Linear.None)
- * .to({ x: 0 }, 1000, Phaser.Easing.Linear.None)
- * .to({ y: 0 }, 1000, Phaser.Easing.Linear.None)
- * .loop();
- * @method Phaser.Tween#loop
- * @return {Phaser.Tween} Itself.
- */
- loop: function() {
-
- this._lastChild.chain(this);
- return this;
-
- },
-
- /**
- * Sets a callback to be fired when the tween starts. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.Tween#onStartCallback
- * @param {function} callback - The callback to invoke on start.
- * @return {Phaser.Tween} Itself.
- */
- onStartCallback: function ( callback ) {
-
- this._onStartCallback = callback;
- return this;
-
- },
-
- /**
- * Sets a callback to be fired each time this tween updates. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.Tween#onUpdateCallback
- * @param {function} callback - The callback to invoke each time this tween is updated.
- * @return {Phaser.Tween} Itself.
- */
- onUpdateCallback: function ( callback ) {
-
- this._onUpdateCallback = callback;
- return this;
-
- },
-
- /**
- * Sets a callback to be fired when the tween completes. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.Tween#onCompleteCallback
- * @param {function} callback - The callback to invoke on completion.
- * @return {Phaser.Tween} Itself.
- */
- onCompleteCallback: function ( callback ) {
-
- this._onCompleteCallback = callback;
- return this;
-
- },
-
- /**
- * Pauses the tween.
- *
- * @method Phaser.Tween#pause
- */
- pause: function () {
- this._paused = true;
- this._pausedTime = this.game.time.now;
- },
-
- /**
- * Resumes a paused tween.
- *
- * @method Phaser.Tween#resume
- */
- resume: function () {
- this._paused = false;
- this._startTime += (this.game.time.now - this._pausedTime);
- },
-
- /**
- * Core tween update function called by the TweenManager. Does not need to be invoked directly.
- *
- * @method Phaser.Tween#update
- * @param {number} time - A timestamp passed in by the TweenManager.
- * @return {boolean} false if the tween has completed and should be deleted from the manager, otherwise true (still active).
- */
- update: function ( time ) {
-
- if (this.pendingDelete)
- {
- return false;
- }
-
- if (this._paused || time < this._startTime) {
-
- return true;
-
- }
-
- var property;
-
- if ( time < this._startTime ) {
-
- return true;
-
- }
-
- if ( this._onStartCallbackFired === false ) {
-
- if ( this._onStartCallback !== null ) {
-
- this._onStartCallback.call( this._object );
-
- }
-
- this._onStartCallbackFired = true;
-
- }
-
- var elapsed = ( time - this._startTime ) / this._duration;
- elapsed = elapsed > 1 ? 1 : elapsed;
-
- var value = this._easingFunction( elapsed );
-
- for ( property in this._valuesEnd ) {
-
- var start = this._valuesStart[ property ] || 0;
- var end = this._valuesEnd[ property ];
-
- if ( end instanceof Array ) {
-
- this._object[ property ] = this._interpolationFunction( end, value );
-
- } else {
-
- // Parses relative end values with start as base (e.g.: +10, -3)
- if ( typeof(end) === "string" ) {
- end = start + parseFloat(end, 10);
- }
-
- // protect against non numeric properties.
- if ( typeof(end) === "number" ) {
- this._object[ property ] = start + ( end - start ) * value;
- }
-
- }
-
- }
-
- if ( this._onUpdateCallback !== null ) {
-
- this._onUpdateCallback.call( this._object, value );
-
- }
-
- if ( elapsed == 1 ) {
-
- if ( this._repeat > 0 ) {
-
- if ( isFinite( this._repeat ) ) {
- this._repeat--;
- }
-
- // reassign starting values, restart by making startTime = now
- for ( property in this._valuesStartRepeat ) {
-
- if ( typeof( this._valuesEnd[ property ] ) === "string" ) {
- this._valuesStartRepeat[ property ] = this._valuesStartRepeat[ property ] + parseFloat(this._valuesEnd[ property ], 10);
- }
-
- if (this._yoyo) {
- var tmp = this._valuesStartRepeat[ property ];
- this._valuesStartRepeat[ property ] = this._valuesEnd[ property ];
- this._valuesEnd[ property ] = tmp;
- this._reversed = !this._reversed;
- }
- this._valuesStart[ property ] = this._valuesStartRepeat[ property ];
-
- }
-
- this._startTime = time + this._delayTime;
-
- this.onComplete.dispatch(this._object);
-
- if ( this._onCompleteCallback !== null ) {
- this._onCompleteCallback.call( this._object );
- }
-
- return true;
-
- } else {
-
- this.onComplete.dispatch(this._object);
-
- if ( this._onCompleteCallback !== null ) {
- this._onCompleteCallback.call( this._object );
- }
-
- for ( var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++ ) {
-
- this._chainedTweens[ i ].start( time );
-
- }
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
-};
-
-/**
-* @author Richard Davey gravity.y
of each particle to this value on launch.
- * @property {number} gravity
- * @default
- */
- this.gravity = 2;
-
- /**
- * Set your own particle class type here.
- * @property {Description} particleClass
- * @default
- */
- this.particleClass = null;
-
- /**
- * The X and Y drag component of particles launched from the emitter.
- * @property {Phaser.Point} particleDrag
- */
- this.particleDrag = new Phaser.Point();
-
- /**
- * The angular drag component of particles launched from the emitter if they are rotating.
- * @property {number} angularDrag
- * @default
- */
- this.angularDrag = 0;
-
- /**
- * How often a particle is emitted in ms (if emitter is started with Explode == false).
- * @property {boolean} frequency
- * @default
- */
- this.frequency = 100;
-
- /**
- * How long each particle lives once it is emitted in ms. Default is 2 seconds.
- * Set lifespan to 'zero' for particles to live forever.
- * @property {number} lifespan
- * @default
- */
- this.lifespan = 2000;
-
- /**
- * How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
- * @property {Phaser.Point} bounce
- */
- this.bounce = new Phaser.Point();
-
- /**
- * Internal helper for deciding how many particles to launch.
- * @property {number} _quantity
- * @private
- * @default
- */
- this._quantity = 0;
-
- /**
- * Internal helper for deciding when to launch particles or kill them.
- * @property {number} _timer
- * @private
- * @default
- */
- this._timer = 0;
-
- /**
- * Internal counter for figuring out how many particles to launch.
- * @property {number} _counter
- * @private
- * @default
- */
- this._counter = 0;
-
- /**
- * Internal helper for the style of particle emission (all at once, or one at a time).
- * @property {boolean} _explode
- * @private
- * @default
- */
- this._explode = true;
-
- /**
- * Determines whether the emitter is currently emitting particles.
- * It is totally safe to directly toggle this.
- * @property {boolean} on
- * @default
- */
- this.on = false;
-
- /**
- * Determines whether the emitter is being updated by the core game loop.
- * @property {boolean} exists
- * @default
- */
- this.exists = true;
-
- /**
- * The point the particles are emitted from.
- * Emitter.x and Emitter.y control the containers location, which updates all current particles
- * Emitter.emitX and Emitter.emitY control the emission location relative to the x/y position.
- * @property {boolean} emitX
- */
- this.emitX = x;
-
- /**
- * The point the particles are emitted from.
- * Emitter.x and Emitter.y control the containers location, which updates all current particles
- * Emitter.emitX and Emitter.emitY control the emission location relative to the x/y position.
- * @property {boolean} emitY
- */
- this.emitY = y;
-
-};
-
-Phaser.Particles.Arcade.Emitter.prototype = Object.create(Phaser.Group.prototype);
-Phaser.Particles.Arcade.Emitter.prototype.constructor = Phaser.Particles.Arcade.Emitter;
-
-/**
-* Called automatically by the game loop, decides when to launch particles and when to "die".
-* @method Phaser.Particles.Arcade.Emitter#update
-*/
-Phaser.Particles.Arcade.Emitter.prototype.update = function () {
-
- if (this.on)
- {
- if (this._explode)
- {
- this._counter = 0;
-
- do
- {
- this.emitParticle();
- this._counter++;
- }
- while (this._counter < this._quantity);
-
- this.on = false;
- }
- else
- {
- if (this.game.time.now >= this._timer)
- {
- this.emitParticle();
-
- this._counter++;
-
- if (this._quantity > 0)
- {
- if (this._counter >= this._quantity)
- {
- this.on = false;
- }
- }
-
- this._timer = this.game.time.now + this.frequency;
- }
- }
- }
-
-}
-
-/**
-* This function generates a new array of particle sprites to attach to the emitter.
-*
-* @method Phaser.Particles.Arcade.Emitter#makeParticles
-* @param {Description} keys - Description.
-* @param {number} frames - Description.
-* @param {number} quantity - The number of particles to generate when using the "create from image" option.
-* @param {number} collide - Description.
-* @param {boolean} collideWorldBounds - Description.
-* @return This Emitter instance (nice for chaining stuff together, if you're into that).
-*/
-Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames, quantity, collide, collideWorldBounds) {
-
- if (typeof frames == 'undefined')
- {
- frames = 0;
- }
-
- quantity = quantity || this.maxParticles;
- collide = collide || 0;
-
- if (typeof collideWorldBounds == 'undefined')
- {
- collideWorldBounds = false;
- }
-
- var particle;
- var i = 0;
- var rndKey = keys;
- var rndFrame = 0;
-
- while (i < quantity)
- {
- if (this.particleClass == null)
- {
- if (typeof keys == 'object')
- {
- rndKey = this.game.rnd.pick(keys);
- }
-
- if (typeof frames == 'object')
- {
- rndFrame = this.game.rnd.pick(frames);
- }
-
- particle = new Phaser.Sprite(this.game, 0, 0, rndKey, rndFrame);
- }
- else
- {
- // particle = new this.particleClass(this.game);
- }
-
- if (collide > 0)
- {
- particle.body.allowCollision.any = true;
- particle.body.allowCollision.none = false;
- }
- else
- {
- particle.body.allowCollision.none = true;
- }
-
- particle.body.collideWorldBounds = collideWorldBounds;
-
- particle.exists = false;
- particle.visible = false;
-
- // Center the origin for rotation assistance
- particle.anchor.setTo(0.5, 0.5);
-
- this.add(particle);
-
- i++;
- }
-
- return this;
-}
-
-/**
- * Call this function to turn off all the particles and the emitter.
- * @method Phaser.Particles.Arcade.Emitter#kill
- */
-Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
-
- this.on = false;
- this.alive = false;
- this.exists = false;
-
-}
-
-/**
- * Handy for bringing game objects "back to life". Just sets alive and exists back to true.
- * In practice, this is most often called by Object.reset()
.
- * @method Phaser.Particles.Arcade.Emitter#revive
- */
-Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
-
- this.alive = true;
- this.exists = true;
-
-}
-
-/**
- * Call this function to start emitting particles.
- * @method Phaser.Particles.Arcade.Emitter#start
- * @param {boolean} explode - Whether the particles should all burst out at once.
- * @param {number} lifespan - How long each particle lives once emitted. 0 = forever.
- * @param {number} frequency - Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
- * @param {number} quantity - How many particles to launch. 0 = "all of the particles".
- */
-Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, frequency, quantity) {
-
- if (typeof explode !== 'boolean')
- {
- explode = true;
- }
-
- lifespan = lifespan || 0;
-
- // How many ms between emissions?
- frequency = frequency || 250;
-
- // Total number of particles to emit
- quantity = quantity || 0;
-
- this.revive();
-
- this.visible = true;
- this.on = true;
-
- this._explode = explode;
- this.lifespan = lifespan;
- this.frequency = frequency;
-
- if (explode)
- {
- this._quantity = quantity;
- }
- else
- {
- this._quantity += quantity;
- }
-
- this._counter = 0;
- this._timer = this.game.time.now + frequency;
-
-}
-
-/**
- * This function can be used both internally and externally to emit the next particle.
- * @method Phaser.Particles.Arcade.Emitter#emitParticle
- */
-Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
-
- var particle = this.getFirstExists(false);
-
- if (particle == null)
- {
- return;
- }
-
- if (this.width > 1 || this.height > 1)
- {
- particle.reset(this.game.rnd.integerInRange(this.left, this.right), this.game.rnd.integerInRange(this.top, this.bottom));
- }
- else
- {
- particle.reset(this.emitX, this.emitY);
- }
-
- particle.lifespan = this.lifespan;
-
- particle.body.bounce.setTo(this.bounce.x, this.bounce.y);
-
- if (this.minParticleSpeed.x != this.maxParticleSpeed.x)
- {
- particle.body.velocity.x = this.game.rnd.integerInRange(this.minParticleSpeed.x, this.maxParticleSpeed.x);
- }
- else
- {
- particle.body.velocity.x = this.minParticleSpeed.x;
- }
-
- if (this.minParticleSpeed.y != this.maxParticleSpeed.y)
- {
- particle.body.velocity.y = this.game.rnd.integerInRange(this.minParticleSpeed.y, this.maxParticleSpeed.y);
- }
- else
- {
- particle.body.velocity.y = this.minParticleSpeed.y;
- }
-
- particle.body.gravity.y = this.gravity;
-
- if (this.minRotation != this.maxRotation)
- {
- particle.body.angularVelocity = this.game.rnd.integerInRange(this.minRotation, this.maxRotation);
- }
- else
- {
- particle.body.angularVelocity = this.minRotation;
- }
-
- if (this.minParticleScale !== 1 || this.maxParticleScale !== 1)
- {
- var scale = this.game.rnd.realInRange(this.minParticleScale, this.maxParticleScale);
- particle.scale.setTo(scale, scale);
- }
-
- particle.body.drag.x = this.particleDrag.x;
- particle.body.drag.y = this.particleDrag.y;
- particle.body.angularDrag = this.angularDrag;
-
-}
-
-/**
-* A more compact way of setting the width and height of the emitter.
-* @method Phaser.Particles.Arcade.Emitter#setSize
-* @param {number} width - The desired width of the emitter (particles are spawned randomly within these dimensions).
-* @param {number} height - The desired height of the emitter.
-*/
-Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
-
- this.width = width;
- this.height = height;
-
-}
-
-/**
-* A more compact way of setting the X velocity range of the emitter.
-* @method Phaser.Particles.Arcade.Emitter#setXSpeed
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
-*/
-Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
-
- min = min || 0;
- max = max || 0;
-
- this.minParticleSpeed.x = min;
- this.maxParticleSpeed.x = max;
-
-}
-
-/**
-* A more compact way of setting the Y velocity range of the emitter.
-* @method Phaser.Particles.Arcade.Emitter#setYSpeed
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
-*/
-Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
-
- min = min || 0;
- max = max || 0;
-
- this.minParticleSpeed.y = min;
- this.maxParticleSpeed.y = max;
-
-}
-
-/**
-* A more compact way of setting the angular velocity constraints of the emitter.
-* @method Phaser.Particles.Arcade.Emitter#setRotation
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
-*/
-Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
-
- min = min || 0;
- max = max || 0;
-
- this.minRotation = min;
- this.maxRotation = max;
-
-}
-
-/**
-* Change the emitter's midpoint to match the midpoint of a Object
.
-* @method Phaser.Particles.Arcade.Emitter#at
-* @param {object} object - The Object
that you want to sync up with.
-*/
-Phaser.Particles.Arcade.Emitter.prototype.at = function (object) {
-
- this.emitX = object.center.x;
- this.emitY = object.center.y;
-
-}
-
-/**
-* The emitters alpha value.
-* @name Phaser.Particles.Arcade.Emitter#alpha
-* @property {number} alpha - Gets or sets the alpha value of the Emitter.
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", {
-
- get: function () {
- return this._container.alpha;
- },
-
- set: function (value) {
- this._container.alpha = value;
- }
-
-});
-
-/**
-* The emitter visible state.
-* @name Phaser.Particles.Arcade.Emitter#visible
-* @property {boolean} visible - Gets or sets the Emitter visible state.
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", {
-
- get: function () {
- return this._container.visible;
- },
-
- set: function (value) {
- this._container.visible = value;
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#x
-* @property {number} x - Gets or sets the x position of the Emitter.
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "x", {
-
- get: function () {
- return this.emitX;
- },
-
- set: function (value) {
- this.emitX = value;
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#y
-* @property {number} y - Gets or sets the y position of the Emitter.
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "y", {
-
- get: function () {
- return this.emitY;
- },
-
- set: function (value) {
- this.emitY = value;
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#left
-* @property {number} left - Gets the left position of the Emitter.
-* @readonly
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "left", {
-
- get: function () {
- return Math.floor(this.x - (this.width / 2));
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#right
-* @property {number} right - Gets the right position of the Emitter.
-* @readonly
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "right", {
-
- get: function () {
- return Math.floor(this.x + (this.width / 2));
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#top
-* @property {number} top - Gets the top position of the Emitter.
-* @readonly
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "top", {
-
- get: function () {
- return Math.floor(this.y - (this.height / 2));
- }
-
-});
-
-/**
-* @name Phaser.Particles.Arcade.Emitter#bottom
-* @property {number} bottom - Gets the bottom position of the Emitter.
-* @readonly
-*/
-Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
-
- get: function () {
- return Math.floor(this.y + (this.height / 2));
- }
-
-});
-
-/**
-* @author Richard Davey Tile
.
-*
-* @class Phaser.Tile
-* @classdesc A Tile is a single representation of a tile within a Tilemap.
-* @constructor
-* @param {Phaser.Game} game - A reference to the currently running game.
-* @param {Tilemap} tilemap - The tilemap this tile belongs to.
-* @param {number} index - The index of this tile type in the core map data.
-* @param {number} width - Width of the tile.
-* @param {number} height - Height of the tile.
-*/
-Phaser.Tile = function (tileset, index, x, y, width, height) {
-
- /**
- * @property {string} tileset - The tileset this tile belongs to.
- */
- this.tileset = tileset;
-
- /**
- * @property {number} index - The index of this tile within the tileset.
- */
- this.index = index;
-
- /**
- * @property {number} width - The width of the tile in pixels.
- */
- this.width = width;
-
- /**
- * @property {number} height - The height of the tile in pixels.
- */
- this.height = height;
-
- /**
- * @property {number} x - The top-left corner of the tile within the tileset.
- */
- this.x = x;
-
- /**
- * @property {number} y - The top-left corner of the tile within the tileset.
- */
- this.y = y;
-
- // Any extra meta data info we need here
-
- /**
- * @property {number} mass - The virtual mass of the tile.
- * @default
- */
- this.mass = 1.0;
-
- /**
- * @property {boolean} collideNone - Indicating this Tile doesn't collide at all.
- * @default
- */
- this.collideNone = true;
-
- /**
- * @property {boolean} collideLeft - Indicating collide with any object on the left.
- * @default
- */
- this.collideLeft = false;
-
- /**
- * @property {boolean} collideRight - Indicating collide with any object on the right.
- * @default
- */
- this.collideRight = false;
-
- /**
- * @property {boolean} collideUp - Indicating collide with any object on the top.
- * @default
- */
- this.collideUp = false;
-
- /**
- * @property {boolean} collideDown - Indicating collide with any object on the bottom.
- * @default
- */
- this.collideDown = false;
-
- /**
- * @property {boolean} separateX - Enable separation at x-axis.
- * @default
- */
- this.separateX = true;
-
- /**
- * @property {boolean} separateY - Enable separation at y-axis.
- * @default
- */
- this.separateY = true;
-
- /**
- * @property {boolean} collisionCallback - Tilemap collision callback.
- * @default
- */
- this.collisionCallback = null;
-
- /**
- * @property {boolean} collisionCallback - Tilemap collision callback.
- * @default
- */
- this.collisionCallbackContext = this;
-
-};
-
-Phaser.Tile.prototype = {
-
- /**
- * Set callback to be called when this tilemap collides.
- *
- * @method Phaser.Tilemap.prototype.setCollisionCallback
- * @param {Function} callback - Callback function.
- * @param {object} context - Callback will be called with this context.
- */
- setCollisionCallback: function (callback, context) {
-
- this.collisionCallbackContext = context;
- this.collisionCallback = callback;
-
- },
-
- /**
- * Clean up memory.
- * @method destroy
- */
- destroy: function () {
-
- this.tileset = null;
-
- },
-
- /**
- * Set collision configs.
- * @method setCollision
- * @param {boolean} left - Indicating collide with any object on the left.
- * @param {boolean} right - Indicating collide with any object on the right.
- * @param {boolean} up - Indicating collide with any object on the top.
- * @param {boolean} down - Indicating collide with any object on the bottom.
- * @param {boolean} reset - Description.
- * @param {boolean} separateX - Separate at x-axis.
- * @param {boolean} separateY - Separate at y-axis.
- */
- setCollision: function (left, right, up, down) {
-
- this.collideLeft = left;
- this.collideRight = right;
- this.collideUp = up;
- this.collideDown = down;
-
- if (left || right || up || down)
- {
- this.collideNone = false;
- }
- else
- {
- this.collideNone = true;
- }
-
- },
-
- /**
- * Reset collision status flags.
- * @method resetCollision
- */
- resetCollision: function () {
-
- this.collideNone = true;
- this.collideLeft = false;
- this.collideRight = false;
- this.collideUp = false;
- this.collideDown = false;
-
- }
-
-};
-
-Object.defineProperty(Phaser.Tile.prototype, "bottom", {
-
- /**
- * The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
- * @method bottom
- * @return {number}
- **/
- get: function () {
- return this.y + this.height;
- }
-
-});
-
-Object.defineProperty(Phaser.Tile.prototype, "right", {
-
- /**
- * The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties.
- * However it does affect the width property.
- * @method right
- * @return {number}
- **/
- get: function () {
- return this.x + this.width;
- }
-
-});
-
-Phaser.Tilemap = function (game, key) {
-
- /**
- * @property {Phaser.Game} game - Description.
- */
- this.game = game;
-
- /**
- * @property {array} layers - Description.
- */
- this.layers;
-
- if (typeof key === 'string')
- {
- this.key = key;
-
- this.layers = game.cache.getTilemapData(key).layers;
- this.calculateIndexes();
- }
- else
- {
- this.layers = [];
- }
-
- this.currentLayer = 0;
-
- this.debugMap = [];
-
- this.dirty = false;
-
- this._results = [];
- this._tempA = 0;
- this._tempB = 0;
-
-};
-
-Phaser.Tilemap.CSV = 0;
-Phaser.Tilemap.TILED_JSON = 1;
-
-Phaser.Tilemap.prototype = {
-
- create: function (name, width, height) {
-
- var data = [];
-
- for (var y = 0; y < height; y++)
- {
- data[y] = [];
-
- for (var x = 0; x < width; x++)
- {
- data[y][x] = 0;
- }
- }
-
- this.currentLayer = this.layers.push({
-
- name: name,
- width: width,
- height: height,
- alpha: 1,
- visible: true,
- tileMargin: 0,
- tileSpacing: 0,
- format: Phaser.Tilemap.CSV,
- data: data,
- indexes: []
-
- });
-
- this.dirty = true;
-
- },
-
- calculateIndexes: function () {
-
- for (var layer = 0; layer < this.layers.length; layer++)
- {
- this.layers[layer].indexes = [];
-
- for (var y = 0; y < this.layers[layer].height ; y++)
- {
- for (var x = 0; x < this.layers[layer].width; x++)
- {
- var idx = this.layers[layer].data[y][x];
-
- if (this.layers[layer].indexes.indexOf(idx) === -1)
- {
- this.layers[layer].indexes.push(idx);
- }
- }
- }
- }
-
- },
-
- setLayer: function (layer) {
-
- if (this.layers[layer])
- {
- this.currentLayer = layer;
- }
-
- },
-
- /**
- * Set a specific tile with its x and y in tiles.
- * @method putTile
- * @param {number} x - X position of this tile.
- * @param {number} y - Y position of this tile.
- * @param {number} index - The index of this tile type in the core map data.
- */
- putTile: function (index, x, y, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- this.layers[layer].data[y][x] = index;
- }
-
- this.dirty = true;
-
- },
-
- getTile: function (x, y, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- return this.layers[layer].data[y][x];
- }
-
- },
-
- getTileWorldXY: function (x, y, tileWidth, tileHeight, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
- y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
-
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- return this.layers[layer].data[y][x];
- }
-
- },
-
- /**
- * Set a specific tile with its x and y in tiles.
- * @method putTileWorldXY
- * @param {number} x - X position of this tile in world coordinates.
- * @param {number} y - Y position of this tile in world coordinates.
- * @param {number} index - The index of this tile type in the core map data.
- */
- putTileWorldXY: function (index, x, y, tileWidth, tileHeight, layer) {
-
- x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
- y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
-
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- this.layers[layer].data[y][x] = index;
- }
-
- this.dirty = true;
-
- },
-
- // Values are in TILEs, not pixels.
- copy: function (x, y, width, height, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- if (!this.layers[layer])
- {
- this._results.length = 0;
- return;
- }
-
- if (typeof x === "undefined") { x = 0; }
- if (typeof y === "undefined") { y = 0; }
- if (typeof width === "undefined") { width = this.layers[layer].width; }
- if (typeof height === "undefined") { height = this.layers[layer].height; }
-
- if (x < 0)
- {
- x = 0;
- }
-
- if (y < 0)
- {
- y = 0;
- }
-
- if (width > this.layers[layer].width)
- {
- width = this.layers[layer].width;
- }
-
- if (height > this.layers[layer].height)
- {
- height = this.layers[layer].height;
- }
-
- this._results.length = 0;
-
- this._results.push( { x: x, y: y, width: width, height: height, layer: layer });
-
- for (var ty = y; ty < y + height; ty++)
- {
- for (var tx = x; tx < x + width; tx++)
- {
- this._results.push({ x: tx, y: ty, index: this.layers[layer].data[ty][tx] });
- }
- }
-
- return this._results;
-
- },
-
- paste: function (x, y, tileblock, layer) {
-
- if (typeof x === "undefined") { x = 0; }
- if (typeof y === "undefined") { y = 0; }
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- if (!tileblock || tileblock.length < 2)
- {
- return;
- }
-
- // Find out the difference between tileblock[1].x/y and x/y and use it as an offset, as it's the top left of the block to paste
- var diffX = tileblock[1].x - x;
- var diffY = tileblock[1].y - y;
-
- for (var i = 1; i < tileblock.length; i++)
- {
- this.layers[layer].data[ diffY + tileblock[i].y ][ diffX + tileblock[i].x ] = tileblock[i].index;
- }
-
- this.dirty = true;
-
- },
-
- /**
- * Swap tiles with 2 kinds of indexes.
- * @method swapTile
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- swap: function (tileA, tileB, x, y, width, height, layer) {
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- this._tempA = tileA;
- this._tempB = tileB;
-
- this._results.forEach(this.swapHandler, this);
-
- this.paste(x, y, this._results);
-
- },
-
- swapHandler: function (value, index, array) {
-
- if (value.index === this._tempA)
- {
- this._results[index].index = this._tempB;
- }
- else if (value.index === this._tempB)
- {
- this._results[index].index = this._tempA;
- }
-
- },
-
- /**
- * Swap tiles with 2 kinds of indexes.
- * @method swapTile
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- forEach: function (callback, context, x, y, width, height, layer) {
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- this._results.forEach(callback, context);
-
- this.paste(x, y, this._results);
-
- },
-
- /**
- * Replaces one type of tile with another.
- * @method replace
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- replace: function (tileA, tileB, x, y, width, height, layer) {
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- for (var i = 1; i < this._results.length; i++)
- {
- if (this._results[i].index === tileA)
- {
- this._results[i].index = tileB;
- }
- }
-
- this.paste(x, y, this._results);
-
- },
-
- /**
- * Randomises a set of tiles in a given area. It will only randomise the tiles in that area, so if they're all the same nothing will appear to have changed!
- * @method random
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- random: function (x, y, width, height, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- var indexes = [];
-
- for (var t = 1; t < this._results.length; t++)
- {
- var idx = this._results[t].index;
-
- if (indexes.indexOf(idx) === -1)
- {
- indexes.push(idx);
- }
- }
-
- for (var i = 1; i < this._results.length; i++)
- {
- this._results[i].index = this.game.rnd.pick(indexes);
- }
-
- this.paste(x, y, this._results);
-
- },
-
- /**
- * Randomises a set of tiles in a given area. It will only randomise the tiles in that area, so if they're all the same nothing will appear to have changed!
- * @method random
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- shuffle: function (x, y, width, height, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- var header = this._results.shift();
-
- Phaser.Utils.shuffle(this._results);
-
- this._results.unshift(header);
-
- this.paste(x, y, this._results);
-
- },
-
- /**
- * Fill a tile block with a specific tile index.
- * @method fill
- * @param {number} index - Index of tiles you want to fill with.
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- */
- fill: function (index, x, y, width, height, layer) {
-
- this.copy(x, y, width, height, layer);
-
- if (this._results.length < 2)
- {
- return;
- }
-
- for (var i = 1; i < this._results.length; i++)
- {
- this._results[i].index = index;
- }
-
- this.paste(x, y, this._results);
-
- },
-
- removeAllLayers: function () {
-
- this.layers.length = 0;
- this.currentLayer = 0;
-
- },
-
- dump: function () {
-
- var txt = '';
- var args = [''];
-
- for (var y = 0; y < this.layers[this.currentLayer].height; y++)
- {
- for (var x = 0; x < this.layers[this.currentLayer].width; x++)
- {
- txt += "%c ";
-
- if (this.layers[this.currentLayer].data[y][x] > 1)
- {
- if (this.debugMap[this.layers[this.currentLayer].data[y][x]])
- {
- args.push("background: " + this.debugMap[this.layers[this.currentLayer].data[y][x]]);
- }
- else
- {
- args.push("background: #ffffff");
- }
- }
- else
- {
- args.push("background: rgb(0, 0, 0)");
- }
- }
-
- txt += "\n";
- }
-
- args[0] = txt;
- console.log.apply(console, args);
-
- },
-
- destroy: function () {
-
- this.removeAllLayers();
- this.game = null;
-
- }
-
-};
-
-// Maybe should extend Sprite?
-Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset, tilemap, layer) {
-
- /**
- * @property {Phaser.Game} game - Description.
- */
- this.game = game;
-
- /**
- * @property {Description} canvas - Description.
- * @default
- */
- this.canvas = Phaser.Canvas.create(renderWidth, renderHeight);
-
- /**
- * @property {Description} context - Description.
- * @default
- */
- this.context = this.canvas.getContext('2d');
-
- /**
- * @property {Description} baseTexture - Description.
- * @default
- */
- this.baseTexture = new PIXI.BaseTexture(this.canvas);
-
- /**
- * @property {Description} texture - Description.
- * @default
- */
- this.texture = new PIXI.Texture(this.baseTexture);
-
- this.textureFrame = new Phaser.Frame(0, 0, 0, renderWidth, renderHeight, 'tilemaplayer', game.rnd.uuid());
-
- Phaser.Sprite.call(this, this.game, x, y, this.texture, this.textureFrame);
-
- this.type = Phaser.TILEMAPLAYER;
-
- this.fixedToCamera = true;
-
- /**
- * @property {Description} tileset - Description.
- */
- this.tileset = null;
-
- this.tileWidth = 0;
- this.tileHeight = 0;
- this.tileMargin = 0;
- this.tileSpacing = 0;
-
- /**
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} widthInPixels
- * @default
- */
- this.widthInPixels = 0;
-
- /**
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} heightInPixels
- * @default
- */
- this.heightInPixels = 0;
-
-
- this.renderWidth = renderWidth;
- this.renderHeight = renderHeight;
-
- /**
- * @property {number} _ga - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._ga = 1;
-
- /**
- * @property {number} _dx - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._dx = 0;
-
- /**
- * @property {number} _dy - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._dy = 0;
-
- /**
- * @property {number} _dw - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._dw = 0;
-
- /**
- * @property {number} _dh - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._dh = 0;
-
- /**
- * @property {number} _tx - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._tx = 0;
-
- /**
- * @property {number} _ty - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._ty = 0;
-
- this._results = [];
-
- this._tw = 0;
- this._th = 0;
-
- /**
- * @property {number} _tl - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._tl = 0;
-
- /**
- * @property {number} _maxX - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._maxX = 0;
-
- /**
- * @property {number} _maxY - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._maxY = 0;
-
- /**
- * @property {number} _startX - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._startX = 0;
-
- /**
- * @property {number} _startY - Local render loop var to help avoid gc spikes.
- * @private
- */
- this._startY = 0;
-
- /**
- * @property {number} scrollFactorX - speed at which this layer scrolls
- * horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls
- * half as quickly as the 'normal' camera-locked layers do)
- * @default 1
- */
- this.scrollFactorX = 1;
- /**
- * @property {number} scrollFactorY - speed at which this layer scrolls
- * vertically, relative to the camera (e.g. scrollFactorY of 0.5 scrolls
- * half as quickly as the 'normal' camera-locked layers do)
- * @default 1
- */
- this.scrollFactorY = 1;
-
- this.tilemap = null;
- this.layer = null;
- this.index = 0;
-
- this._x = 0;
- this._y = 0;
- this._prevX = 0;
- this._prevY = 0;
-
- this.dirty = true;
-
- if (tileset instanceof Phaser.Tileset || typeof tileset === 'string')
- {
- this.updateTileset(tileset);
- }
-
- if (tilemap instanceof Phaser.Tilemap)
- {
- this.updateMapData(tilemap, layer);
- }
-
-};
-
-Phaser.TilemapLayer.prototype = Object.create(Phaser.Sprite.prototype);
-Phaser.TilemapLayer.prototype = Phaser.Utils.extend(true, Phaser.TilemapLayer.prototype, Phaser.Sprite.prototype, PIXI.Sprite.prototype);
-Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer;
-
-
-Phaser.TilemapLayer.prototype.update = function () {
-
- this.scrollX = this.game.camera.x * this.scrollFactorX;
- this.scrollY = this.game.camera.y * this.scrollFactorY;
-
- this.render();
-
-}
-
-Phaser.TilemapLayer.prototype.resizeWorld = function () {
-
- this.game.world.setBounds(0, 0, this.widthInPixels, this.heightInPixels);
-
-}
-
-Phaser.TilemapLayer.prototype.updateTileset = function (tileset) {
-
- if (tileset instanceof Phaser.Tileset)
- {
- this.tileset = tileset;
- }
- else if (typeof tileset === 'string')
- {
- this.tileset = this.game.cache.getTileset('tiles');
- }
- else
- {
- return;
- }
-
- this.tileWidth = this.tileset.tileWidth;
- this.tileHeight = this.tileset.tileHeight;
- this.tileMargin = this.tileset.tileMargin;
- this.tileSpacing = this.tileset.tileSpacing;
-
- this.updateMax();
-
-}
-
-Phaser.TilemapLayer.prototype.updateMapData = function (tilemap, layer) {
-
- if (typeof layer === 'undefined')
- {
- layer = 0;
- }
-
- if (tilemap instanceof Phaser.Tilemap)
- {
- this.tilemap = tilemap;
- this.layer = this.tilemap.layers[layer];
- this.index = layer;
- this.updateMax();
- this.tilemap.dirty = true;
- }
-
-}
-
-/**
- * Take an x coordinate that doesn't account for scrollFactorY and 'fix' it
- * into a scrolled local space. Used primarily internally
- * @param {number} x - x coordinate in camera space
- * @return {number} x coordinate in scrollFactor-adjusted dimensions
- */
-Phaser.TilemapLayer.prototype._fixX = function(x) {
-
- if (this.scrollFactorX === 1)
- {
- return x;
- }
-
- var left_edge = x - (this._x / this.scrollFactorX);
-
- return this._x + left_edge;
-
-}
-
-/**
- * Take an x coordinate that _does_ account for scrollFactorY and 'unfix' it
- * back to camera space. Used primarily internally
- * @param {number} x - x coordinate in scrollFactor-adjusted dimensions
- * @return {number} x coordinate in camera space
- */
-Phaser.TilemapLayer.prototype._unfixX = function(x) {
-
- if (this.scrollFactorX === 1)
- {
- return x;
- }
-
- var left_edge = x - this._x;
-
- return (this._x / this.scrollFactorX) + left_edge;
-
-}
-
-/**
- * Take a y coordinate that doesn't account for scrollFactorY and 'fix' it
- * into a scrolled local space. Used primarily internally
- * @param {number} y - y coordinate in camera space
- * @return {number} y coordinate in scrollFactor-adjusted dimensions
- */
-Phaser.TilemapLayer.prototype._fixY = function(y) {
-
- if (this.scrollFactorY === 1)
- {
- return y;
- }
-
- var top_edge = y - (this._y / this.scrollFactorY);
-
- return this._y + top_edge;
-
-}
-
-/**
- * Take a y coordinate that _does_ account for scrollFactorY and 'unfix' it
- * back to camera space. Used primarily internally
- * @param {number} y - y coordinate in scrollFactor-adjusted dimensions
- * @return {number} y coordinate in camera space
- */
-Phaser.TilemapLayer.prototype._unfixY = function(y) {
-
- if (this.scrollFactorY === 1)
- {
- return y;
- }
-
- var top_edge = y - this._y;
-
- return (this._y / this.scrollFactorY) + top_edge;
-
-}
-
-/**
-* Convert a pixel value to a tile coordinate.
-* @param {number} x - X position of the point in target tile.
-* @param {number} [layer] - layer of this tile located.
-* @return {number} The tile with specific properties.
-*/
-Phaser.TilemapLayer.prototype.getTileX = function (x) {
-
- var tileWidth = this.tileWidth * this.scale.x;
-
- return this.game.math.snapToFloor(this._fixX(x), tileWidth) / tileWidth;
-
-}
-
-/**
-* Convert a pixel value to a tile coordinate.
-* @param {number} x - X position of the point in target tile.
-* @param {number} [layer] - layer of this tile located.
-* @return {number} The tile with specific properties.
-*/
-Phaser.TilemapLayer.prototype.getTileY = function (y) {
-
- var tileHeight = this.tileHeight * this.scale.y;
-
- return this.game.math.snapToFloor(this._fixY(y), tileHeight) / tileHeight;
-
-}
-
-Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
-
- point.x = this.getTileX(x);
- point.y = this.getTileY(y);
-
- return point;
-
-}
-
-/**
-*
-* @method getTileOverlaps
-* @param {GameObject} object - Tiles you want to get that overlaps this.
-* @return {array} Array with tiles informations (each contains x, y, and the tile).
-*/
-Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides) {
-
- if (this.tilemap === null)
- {
- return;
- }
-
- // Should we only get tiles that have at least one of their collision flags set? (true = yes, false = no just get them all)
- if (typeof collides === 'undefined') { collides = false; }
-
- // Cap the values
-
- if (x < 0)
- {
- x = 0;
- }
-
- if (y < 0)
- {
- y = 0;
- }
-
- // adjust the x,y coordinates for scrollFactor
- x = this._fixX( x );
- y = this._fixY( y );
-
- if (width > this.widthInPixels)
- {
- width = this.widthInPixels;
- }
-
- if (height > this.heightInPixels)
- {
- height = this.heightInPixels;
- }
-
- var tileWidth = this.tileWidth * this.scale.x;
- var tileHeight = this.tileHeight * this.scale.y;
-
- // Convert the pixel values into tile coordinates
- this._tx = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
- this._ty = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
- this._tw = (this.game.math.snapToCeil(width, tileWidth) + tileWidth) / tileWidth;
- this._th = (this.game.math.snapToCeil(height, tileHeight) + tileHeight) / tileHeight;
-
- // This should apply the layer x/y here
-
- // this._results.length = 0;
- this._results = [];
-
- // pretty sure we don't use this any more?
- // this._results.push( { x: x, y: y, width: width, height: height, tx: this._tx, ty: this._ty, tw: this._tw, th: this._th });
-
- var _index = 0;
- var _tile = null;
- var sx = 0;
- var sy = 0;
-
- for (var wy = this._ty; wy < this._ty + this._th; wy++)
- {
- for (var wx = this._tx; wx < this._tx + this._tw; wx++)
- {
- if (this.layer.data[wy] && this.layer.data[wy][wx])
- {
- // Could combine
- _index = this.layer.data[wy][wx] - 1;
- _tile = this.tileset.getTile(_index);
-
- sx = _tile.width * this.scale.x;
- sy = _tile.height * this.scale.y;
-
- if (collides == false || (collides && _tile.collideNone == false))
- {
- // convert tile coordinates back to camera space for return
- var _wx = this._unfixX( wx*sx ) / tileWidth;
- var _wy = this._unfixY( wy*sy ) / tileHeight;
- this._results.push({ x: _wx * sx, right: (_wx * sx) + sx, y: _wy * sy, bottom: (_wy * sy) + sy, width: sx, height: sy, tx: _wx, ty: _wy, tile: _tile });
- }
- }
- }
- }
-
- return this._results;
-
-}
-
-Phaser.TilemapLayer.prototype.updateMax = function () {
-
- this._maxX = this.game.math.ceil(this.canvas.width / this.tileWidth) + 1;
- this._maxY = this.game.math.ceil(this.canvas.height / this.tileHeight) + 1;
-
- if (this.layer)
- {
- if (this._maxX > this.layer.width)
- {
- this._maxX = this.layer.width;
- }
-
- if (this._maxY > this.layer.height)
- {
- this._maxY = this.layer.height;
- }
-
- this.widthInPixels = this.layer.width * this.tileWidth;
- this.heightInPixels = this.layer.height * this.tileHeight;
- }
-
- this.dirty = true;
-
-}
-
-Phaser.TilemapLayer.prototype.render = function () {
-
- if (this.tilemap && this.tilemap.dirty)
- {
- this.dirty = true;
- }
-
- if (!this.dirty || !this.tileset || !this.tilemap || !this.visible)
- {
- return;
- }
-
- this._prevX = this._dx;
- this._prevY = this._dy;
-
- this._dx = -(this._x - (this._startX * this.tileWidth));
- this._dy = -(this._y - (this._startY * this.tileHeight));
-
- this._tx = this._dx;
- this._ty = this._dy;
-
- this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
-
- for (var y = this._startY; y < this._startY + this._maxY; y++)
- {
- this._column = this.layer.data[y];
-
- for (var x = this._startX; x < this._startX + this._maxX; x++)
- {
- // only -1 on TILED maps, not CSV
- var tile = this.tileset.tiles[this._column[x]-1];
-
- if (tile)
- {
- this.context.drawImage(
- this.tileset.image,
- tile.x,
- tile.y,
- this.tileWidth,
- this.tileHeight,
- Math.floor(this._tx),
- Math.floor(this._ty),
- this.tileWidth,
- this.tileHeight
- );
- }
-
- this._tx += this.tileWidth;
-
- }
-
- this._tx = this._dx;
- this._ty += this.tileHeight;
- }
-
- // Only needed if running in WebGL, otherwise this array will never get cleared down I don't think!
- if (this.game.renderType == Phaser.WEBGL)
- {
- PIXI.texturesToUpdate.push(this.baseTexture);
- }
-
- this.dirty = false;
-
- if (this.tilemap.dirty)
- {
- this.tilemap.dirty = false;
- }
-
- return true;
-
-}
-
-Phaser.TilemapLayer.prototype.deltaAbsX = function () {
- return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
-}
-
-Phaser.TilemapLayer.prototype.deltaAbsY = function () {
- return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
-}
-
-Phaser.TilemapLayer.prototype.deltaX = function () {
- return this._dx - this._prevX;
-}
-
-Phaser.TilemapLayer.prototype.deltaY = function () {
- return this._dy - this._prevY;
-}
-
-Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", {
-
- get: function () {
- return this._x;
- },
-
- set: function (value) {
-
- if (value !== this._x && value >= 0 && this.layer)
- {
- this._x = value;
-
- if (this._x > (this.widthInPixels - this.renderWidth))
- {
- this._x = this.widthInPixels - this.renderWidth;
- }
-
- this._startX = this.game.math.floor(this._x / this.tileWidth);
-
- if (this._startX < 0)
- {
- this._startX = 0;
- }
-
- if (this._startX + this._maxX > this.layer.width)
- {
- this._startX = this.layer.width - this._maxX;
- }
-
- this.dirty = true;
- }
-
- }
-
-});
-
-Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
-
- get: function () {
- return this._y;
- },
-
- set: function (value) {
-
- if (value !== this._y && value >= 0 && this.layer)
- {
- this._y = value;
-
- if (this._y > (this.heightInPixels - this.renderHeight))
- {
- this._y = this.heightInPixels - this.renderHeight;
- }
-
- this._startY = this.game.math.floor(this._y / this.tileHeight);
-
- if (this._startY < 0)
- {
- this._startY = 0;
- }
-
- if (this._startY + this._maxY > this.layer.height)
- {
- this._startY = this.layer.height - this._maxY;
- }
-
- this.dirty = true;
- }
-
- }
-
-});
-
-Phaser.TilemapParser = {
-
- tileset: function (game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
-
- // How big is our image?
- var img = game.cache.getTilesetImage(key);
-
- if (img == null)
- {
- return null;
- }
-
- var width = img.width;
- var height = img.height;
-
- // If no tile width/height is given, try and figure it out (won't work if the tileset has margin/spacing)
- if (tileWidth <= 0)
- {
- tileWidth = Math.floor(-width / Math.min(-1, tileWidth));
- }
-
- if (tileHeight <= 0)
- {
- tileHeight = Math.floor(-height / Math.min(-1, tileHeight));
- }
-
- var row = Math.round(width / tileWidth);
- var column = Math.round(height / tileHeight);
- var total = row * column;
-
- if (tileMax !== -1)
- {
- total = tileMax;
- }
-
- // Zero or smaller than tile sizes?
- if (width == 0 || height == 0 || width < tileWidth || height < tileHeight || total === 0)
- {
- console.warn("Phaser.TilemapParser.tileSet: width/height zero or width/height < given tileWidth/tileHeight");
- return null;
- }
-
- // Let's create some tiles
- var x = tileMargin;
- var y = tileMargin;
-
- var tileset = new Phaser.Tileset(img, key, tileWidth, tileHeight, tileMargin, tileSpacing);
-
- for (var i = 0; i < total; i++)
- {
- tileset.addTile(new Phaser.Tile(tileset, i, x, y, tileWidth, tileHeight));
-
- x += tileWidth + tileSpacing;
-
- if (x === width)
- {
- x = tileMargin;
- y += tileHeight + tileSpacing;
- }
- }
-
- return tileset;
-
- },
-
- parse: function (game, data, format) {
-
- if (format === Phaser.Tilemap.CSV)
- {
- return this.parseCSV(data);
- }
- else if (format === Phaser.Tilemap.TILED_JSON)
- {
- return this.parseTiledJSON(data);
- }
-
- },
-
- /**
- * Parse csv map data and generate tiles.
- *
- * @method Phaser.Tilemap.prototype.parseCSV
- * @param {string} data - CSV map data.
- */
- parseCSV: function (data) {
-
- // Trim any rogue whitespace from the data
- data = data.trim();
-
- var output = [];
- var rows = data.split("\n");
- var height = rows.length;
- var width = 0;
-
- for (var i = 0; i < rows.length; i++)
- {
- output[i] = [];
-
- var column = rows[i].split(",");
-
- for (var c = 0; c < column.length; c++)
- {
- output[i][c] = parseInt(column[c]);
- }
-
- if (width == 0)
- {
- width = column.length;
- }
- }
-
- return [{ name: 'csv', width: width, height: height, alpha: 1, visible: true, indexes: [], tileMargin: 0, tileSpacing: 0, data: output }];
-
- },
-
- /**
- * Parse JSON map data and generate tiles.
- *
- * @method Phaser.Tilemap.prototype.parseTiledJSON
- * @param {string} data - JSON map data.
- * @param {string} key - Asset key for tileset image.
- */
- parseTiledJSON: function (json) {
-
- var layers = [];
-
- for (var i = 0; i < json.layers.length; i++)
- {
- // Check it's a data layer
- if (!json.layers[i].data)
- {
- continue;
- }
-
- // json.tilewidth
- // json.tileheight
-
- var layer = {
-
- name: json.layers[i].name,
- width: json.layers[i].width,
- height: json.layers[i].height,
- alpha: json.layers[i].opacity,
- visible: json.layers[i].visible,
- indexes: [],
-
- tileMargin: json.tilesets[0].margin,
- tileSpacing: json.tilesets[0].spacing,
-
- };
-
- var output = [];
- var c = 0;
- var row;
-
- for (var t = 0; t < json.layers[i].data.length; t++)
- {
- if (c == 0)
- {
- row = [];
- }
-
- row.push(json.layers[i].data[t]);
- c++;
-
- if (c == json.layers[i].width)
- {
- output.push(row);
- c = 0;
- }
- }
-
- layer.data = output;
-
- layers.push(layer);
-
- }
-
- return layers;
-
- }
-
-}
-
-
-Phaser.Tileset = function (image, key, tileWidth, tileHeight, tileMargin, tileSpacing) {
-
- if (typeof tileMargin === "undefined") { tileMargin = 0; }
- if (typeof tileSpacing === "undefined") { tileSpacing = 0; }
-
- /**
- * @property {string} key - The cache ID.
- */
- this.key = key;
-
- this.image = image;
-
- this.tileWidth = tileWidth;
- this.tileHeight = tileHeight;
- this.margin = tileMargin;
- this.spacing = tileSpacing;
-
- this.tiles = [];
-
-}
-
-Phaser.Tileset.prototype = {
-
- addTile: function (tile) {
-
- this.tiles.push(tile);
-
- return tile;
-
- },
-
- getTile: function (index) {
-
- if (this.tiles[index])
- {
- return this.tiles[index];
- }
-
- return null;
-
- },
-
- setSpacing: function (margin, spacing) {
-
- this.tileMargin = margin;
- this.tileSpacing = spacing;
-
- },
-
- canCollide: function (index) {
-
- if (this.tiles[index])
- {
- return this.tiles[index].collideNone;
- }
-
- return null;
-
- },
-
- checkTileIndex: function (index) {
-
- return (this.tiles[index]);
-
- },
-
- setCollisionRange: function (start, stop, left, right, up, down) {
-
- if (this.tiles[start] && this.tiles[stop] && start < stop)
- {
- for (var i = start; i <= stop; i++)
- {
- this.tiles[i].setCollision(left, right, up, down);
- }
- }
-
- },
-
- setCollision: function (index, left, right, up, down) {
-
- if (this.tiles[index])
- {
- this.tiles[index].setCollision(left, right, up, down);
- }
-
- },
-
-}
-
-/**
-* @name Phaser.Tileset#total
-* @property {number} total - The total number of tiles in this Tileset.
-* @readonly
-*/
-Object.defineProperty(Phaser.Tileset.prototype, "total", {
-
- get: function () {
- return this.tiles.length;
- }
-
-});
-
-/**
-* We're replacing a couple of Pixi's methods here to fix or add some vital functionality:
-*
-* 1) Added support for Trimmed sprite sheets
-* 2) Skip display objects with an alpha of zero
-* 3) Avoid Style Recalculation from the incorrect bgcolor value
-*
-* Hopefully we can remove this once Pixi has been updated to support these things.
-*/
-
-/**
- * Renders the stage to its canvas view
- *
- * @method render
- * @param stage {Stage} the Stage element to be rendered
- */
-PIXI.CanvasRenderer.prototype.render = function(stage)
-{
- PIXI.texturesToUpdate.length = 0;
- PIXI.texturesToDestroy.length = 0;
-
- PIXI.visibleCount++;
- stage.updateTransform();
-
- // update the background color
- // if(this.view.style.backgroundColor!=stage.backgroundColorString && !this.transparent)this.view.style.backgroundColor = stage.backgroundColorString;
-
- this.context.setTransform(1, 0, 0, 1, 0, 0);
- this.context.clearRect(0, 0, this.width, this.height)
- this.renderDisplayObject(stage);
-
- // Remove frame updates
- if (PIXI.Texture.frameUpdates.length > 0)
- {
- PIXI.Texture.frameUpdates.length = 0;
- }
-
-}
-
-PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
-{
- // Once the display object hits this we can break the loop
- var testObject = displayObject.last._iNext;
- displayObject = displayObject.first;
-
- do
- {
- //transform = displayObject.worldTransform;
-
- if (!displayObject.visible)
- {
- displayObject = displayObject.last._iNext;
- continue;
- }
-
- if (!displayObject.renderable || displayObject.alpha == 0)
- {
- displayObject = displayObject._iNext;
- continue;
- }
-
- if (displayObject instanceof PIXI.Sprite)
- {
- // var frame = displayObject.texture.frame;
-
- if (displayObject.texture.frame)
- {
- this.context.globalAlpha = displayObject.worldAlpha;
-
- if (displayObject.texture.trimmed)
- {
- this.context.setTransform(displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], displayObject.worldTransform[2] + displayObject.texture.trim.x, displayObject.worldTransform[5] + displayObject.texture.trim.y);
- }
- else
- {
- this.context.setTransform(displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], displayObject.worldTransform[2], displayObject.worldTransform[5]);
- }
-
- this.context.drawImage(
- displayObject.texture.baseTexture.source,
- displayObject.texture.frame.x,
- displayObject.texture.frame.y,
- displayObject.texture.frame.width,
- displayObject.texture.frame.height,
- (displayObject.anchor.x) * -displayObject.texture.frame.width,
- (displayObject.anchor.y) * -displayObject.texture.frame.height,
- displayObject.texture.frame.width,
- displayObject.texture.frame.height);
- }
- }
- else if (displayObject instanceof PIXI.Strip)
- {
- this.context.setTransform(displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], displayObject.worldTransform[2], displayObject.worldTransform[5])
- this.renderStrip(displayObject);
- }
- else if (displayObject instanceof PIXI.TilingSprite)
- {
- this.context.setTransform(displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], displayObject.worldTransform[2], displayObject.worldTransform[5])
- this.renderTilingSprite(displayObject);
- }
- else if (displayObject instanceof PIXI.CustomRenderable)
- {
- displayObject.renderCanvas(this);
- }
- else if (displayObject instanceof PIXI.Graphics)
- {
- this.context.setTransform(displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], displayObject.worldTransform[2], displayObject.worldTransform[5])
- PIXI.CanvasGraphics.renderGraphics(displayObject, this.context);
- }
- else if (displayObject instanceof PIXI.FilterBlock)
- {
- if (displayObject.open)
- {
- this.context.save();
-
- var cacheAlpha = displayObject.mask.alpha;
- var maskTransform = displayObject.mask.worldTransform;
-
- this.context.setTransform(maskTransform[0], maskTransform[3], maskTransform[1], maskTransform[4], maskTransform[2], maskTransform[5])
-
- displayObject.mask.worldAlpha = 0.5;
-
- this.context.worldAlpha = 0;
-
- PIXI.CanvasGraphics.renderGraphicsMask(displayObject.mask, this.context);
- this.context.clip();
-
- displayObject.mask.worldAlpha = cacheAlpha;
- }
- else
- {
- this.context.restore();
- }
- }
- // count++
- displayObject = displayObject._iNext;
- }
- while(displayObject != testObject)
-
-}
-
-PIXI.WebGLBatch.prototype.update = function()
-{
- var gl = this.gl;
- var worldTransform, width, height, aX, aY, w0, w1, h0, h1, index, index2, index3
-
- var a, b, c, d, tx, ty;
-
- var indexRun = 0;
-
- var displayObject = this.head;
-
- while(displayObject)
- {
- if(displayObject.vcount === PIXI.visibleCount)
- {
- width = displayObject.texture.frame.width;
- height = displayObject.texture.frame.height;
-
- // TODO trim??
- aX = displayObject.anchor.x;// - displayObject.texture.trim.x
- aY = displayObject.anchor.y; //- displayObject.texture.trim.y
- w0 = width * (1-aX);
- w1 = width * -aX;
-
- h0 = height * (1-aY);
- h1 = height * -aY;
-
- index = indexRun * 8;
-
- worldTransform = displayObject.worldTransform;
-
- a = worldTransform[0];
- b = worldTransform[3];
- c = worldTransform[1];
- d = worldTransform[4];
- tx = worldTransform[2];
- ty = worldTransform[5];
-
- if (displayObject.texture.trimmed)
- {
- tx += displayObject.texture.trim.x;
- ty += displayObject.texture.trim.y;
- }
-
- this.verticies[index + 0 ] = a * w1 + c * h1 + tx;
- this.verticies[index + 1 ] = d * h1 + b * w1 + ty;
-
- this.verticies[index + 2 ] = a * w0 + c * h1 + tx;
- this.verticies[index + 3 ] = d * h1 + b * w0 + ty;
-
- this.verticies[index + 4 ] = a * w0 + c * h0 + tx;
- this.verticies[index + 5 ] = d * h0 + b * w0 + ty;
-
- this.verticies[index + 6] = a * w1 + c * h0 + tx;
- this.verticies[index + 7] = d * h0 + b * w1 + ty;
-
- if(displayObject.updateFrame || displayObject.texture.updateFrame)
- {
- this.dirtyUVS = true;
-
- var texture = displayObject.texture;
-
- var frame = texture.frame;
- var tw = texture.baseTexture.width;
- var th = texture.baseTexture.height;
-
- this.uvs[index + 0] = frame.x / tw;
- this.uvs[index +1] = frame.y / th;
-
- this.uvs[index +2] = (frame.x + frame.width) / tw;
- this.uvs[index +3] = frame.y / th;
-
- this.uvs[index +4] = (frame.x + frame.width) / tw;
- this.uvs[index +5] = (frame.y + frame.height) / th;
-
- this.uvs[index +6] = frame.x / tw;
- this.uvs[index +7] = (frame.y + frame.height) / th;
-
- displayObject.updateFrame = false;
- }
-
- // TODO this probably could do with some optimisation....
- if(displayObject.cacheAlpha != displayObject.worldAlpha)
- {
- displayObject.cacheAlpha = displayObject.worldAlpha;
-
- var colorIndex = indexRun * 4;
- this.colors[colorIndex] = this.colors[colorIndex + 1] = this.colors[colorIndex + 2] = this.colors[colorIndex + 3] = displayObject.worldAlpha;
- this.dirtyColors = true;
- }
- }
- else
- {
- index = indexRun * 8;
-
- this.verticies[index + 0 ] = 0;
- this.verticies[index + 1 ] = 0;
-
- this.verticies[index + 2 ] = 0;
- this.verticies[index + 3 ] = 0;
-
- this.verticies[index + 4 ] = 0;
- this.verticies[index + 5 ] = 0;
-
- this.verticies[index + 6] = 0;
- this.verticies[index + 7] = 0;
- }
-
- indexRun++;
- displayObject = displayObject.__next;
- }
-}
- return Phaser;
-});
\ No newline at end of file
diff --git a/examples/wip/bounds.js b/examples/wip/bounds.js
deleted file mode 100644
index 5457358e1..000000000
--- a/examples/wip/bounds.js
+++ /dev/null
@@ -1,32 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('pic', 'assets/sprites/exocet_spaceman.png');
-
-}
-
-var sprite;
-
-function create() {
-
- game.stage.backgroundColor = '#997683';
-
- sprite = game.add.sprite(game.world.centerX, game.world.centerY, 'pic');
- sprite.anchor.setTo(0.5);
-
-}
-
-
-function update() {
-
- sprite.rotation += 0.01;
-
-}
-
-function render() {
-
- game.debug.geom(sprite.getLocalBounds(), 'rgb(255, 255, 255)', false);
-
-}
diff --git a/examples/wip/camera follow.js b/examples/wip/camera follow.js
deleted file mode 100644
index 74e4f8a28..000000000
--- a/examples/wip/camera follow.js
+++ /dev/null
@@ -1,52 +0,0 @@
-
-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('box', 'assets/sprites/block.png');
-
-}
-
-var cursors;
-var sprite;
-
-function create() {
-
- game.world.setBounds(0, 0, 1920, 1200);
- game.add.image(0, 0, 'backdrop');
-
- sprite = game.add.sprite(300, 300, 'box');
-
- game.camera.follow(sprite);
-
- cursors = game.input.keyboard.createCursorKeys();
-
-}
-
-function update() {
-
- if (cursors.left.isDown)
- {
- sprite.x -= 8;
- }
- else if (cursors.right.isDown)
- {
- sprite.x += 8;
- }
-
- if (cursors.up.isDown)
- {
- sprite.y -= 8;
- }
- else if (cursors.down.isDown)
- {
- sprite.y += 8;
- }
-
-}
-
-function render() {
-
-
-}
diff --git a/examples/wip/camera.js b/examples/wip/camera.js
deleted file mode 100644
index 081abc74b..000000000
--- a/examples/wip/camera.js
+++ /dev/null
@@ -1,47 +0,0 @@
-
-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('box', 'assets/sprites/block.png');
-
-}
-
-var cursors;
-
-function create() {
-
- game.world.setBounds(0, 0, 1920, 1200);
- game.add.sprite(0, 0, 'backdrop');
-
- cursors = game.input.keyboard.createCursorKeys();
-
-}
-
-function update() {
-
- if (cursors.left.isDown)
- {
- game.camera.x -= 8;
- }
- else if (cursors.right.isDown)
- {
- game.camera.x += 8;
- }
-
- if (cursors.up.isDown)
- {
- game.camera.y -= 8;
- }
- else if (cursors.down.isDown)
- {
- game.camera.y += 8;
- }
-
-}
-
-function render() {
-
-
-}
diff --git a/examples/wip/cannon.js b/examples/wip/cannon.js
deleted file mode 100644
index 31b11b00e..000000000
--- a/examples/wip/cannon.js
+++ /dev/null
@@ -1,136 +0,0 @@
-
-// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- // game.load.image('arrow', 'assets/sprites/arrow.png');
- game.load.image('arrow', 'assets/sprites/thrust_ship2.png');
- game.load.image('chunk', 'assets/sprites/chunk.png');
- game.load.image('box', 'assets/sprites/block.png');
- game.load.spritesheet('bullets', 'assets/sprites/balls.png', 17, 17);
-
-}
-
-var cannon;
-var bullets;
-var angle = 0;
-var fireRate = 100;
-var nextFire = 0;
-var cursors;
-var boxes;
-var playerGroup;
-var bulletGroup;
-var boxGroup;
-
-function create() {
-
- game.stage.backgroundColor = '#2d2d2d';
-
- game.physics.gravity[1] = -8.5;
- game.physics.defaultRestitution = 0.8;
- game.physics.defaultFriction = 0.1;
-
- bullets = game.add.group();
- bullets.createMultiple(250, 'bullets', 0, false);
-
- cannon = game.add.sprite(50, 500, 'arrow');
- cannon.name = 'ship';
- cannon.physicsEnabled = true;
- cannon.body.setCircle(32);
-
- playerGroup = game.physics.createCollisionGroup();
- bulletGroup = game.physics.createCollisionGroup();
- boxGroup = game.physics.createCollisionGroup();
-
- cannon.body.setCollisionGroup(playerGroup);
- cannon.body.collides(boxGroup);
-
- boxes = game.add.group();
-
- for (var i = 0; i < 30; i++)
- {
- var box = boxes.create(game.rnd.integerInRange(100, 700), game.rnd.integerInRange(100, 500), 'box');
- box.name = 'box' + i;
- box.scale.set(game.rnd.realInRange(0.2, 0.7));
- box.physicsEnabled = true;
- box.body.setCollisionGroup(boxGroup);
- box.body.collides( [ playerGroup, bulletGroup, boxGroup ]);
- }
-
- cursors = game.input.keyboard.createCursorKeys();
-
-}
-
-function fire() {
-
- if (game.time.now > nextFire)
- {
- nextFire = game.time.now + fireRate;
-
- var bullet = bullets.getFirstExists(false);
-
- if (bullet)
- {
- bullet.frame = game.rnd.integerInRange(0,6);
- bullet.exists = true;
- bullet.position.set(cannon.x, cannon.y);
- bullet.physicsEnabled = true;
- bullet.body.collideWorldBounds = false;
- bullet.body.rotation = cannon.rotation - game.math.degToRad(90);
-
- var magnitude = game.math.px2p(-500);
- var angle = bullet.body.rotation + Math.PI / 2;
-
- bullet.body.velocity.x = magnitude * Math.cos(angle);
- bullet.body.velocity.y = magnitude * Math.sin(angle);
-
- bullet.body.setCollisionGroup(bulletGroup);
- bullet.body.collides(boxGroup);
- }
- }
-
-}
-
-function update() {
-
- if (cursors.left.isDown)
- {
- cannon.body.rotateLeft(100);
- }
- else if (cursors.right.isDown)
- {
- cannon.body.rotateRight(100);
- }
- else
- {
- cannon.body.setZeroRotation();
- }
-
- if (cursors.up.isDown)
- {
- // cannon.body.moveForward(200);
- cannon.body.thrust(200);
- }
- else if (cursors.down.isDown)
- {
- // cannon.body.moveBackward(200);
- cannon.body.reverse(200);
- }
-
- var dx = game.input.activePointer.worldX - cannon.x;
- var dy = game.input.activePointer.worldY - cannon.y;
- cannon.rotation = Math.atan2(dy, dx);
-
- if (game.input.activePointer.isDown)
- {
- fire();
- }
-
-}
-
-function render() {
-
- game.debug.physicsBody(cannon.body);
-
-}
diff --git a/examples/wip/class update.js b/examples/wip/class update.js
deleted file mode 100644
index 869ea14b3..000000000
--- a/examples/wip/class update.js
+++ /dev/null
@@ -1,38 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-ClassA = function(game, x, y, texture) {
- Phaser.Sprite.call(this, game, x, y, texture);
-}
-
-ClassA.prototype = Object.create(Phaser.Sprite.prototype);
-ClassA.prototype.constructor = ClassA;
-
-ClassA.prototype.update = function() {
- console.log("here");
-}
-
-function preload() {
-
- game.load.image('pic', 'assets/pics/questar.png');
-
-}
-
-var sprite;
-
-function create() {
-
- sprite = new ClassA(game, 100, 100, 'pic');
-
- game.add.existing(sprite);
-
-}
-
-function update() {
-
-
-}
-
-function render() {
-
-}
diff --git a/examples/wip/cocoon.php b/examples/wip/cocoon.php
deleted file mode 100644
index 1fa8c73ee..000000000
--- a/examples/wip/cocoon.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
";
- }
-
- return $output;
-
- }
-?>
-
-
-
-
- work in progress filters
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/wip/filters/lightbeam_demo.js b/examples/wip/filters/lightbeam_demo.js
deleted file mode 100644
index 3802670f6..000000000
--- a/examples/wip/filters/lightbeam_demo.js
+++ /dev/null
@@ -1,41 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update });
-
-var background;
-var filter;
-
-function preload() {
-
- game.load.image('phaser', 'assets/sprites/phaser2.png');
- game.load.script('light', '../filters/LightBeam.js');
-
-}
-
-function create() {
-
- var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'phaser');
- logo.anchor.setTo(0.5, 0.5);
-
- background = game.add.sprite(0, 0);
- background.width = 800;
- background.height = 600;
-
- filter = game.add.filter('LightBeam', 800, 600);
-
- // You have the following values to play with (defaults shown):
- filter.alpha = 0.0;
- // filter.red = 1.0;
- // filter.green = 1.0;
- // filter.blue = 2.0;
- // filter.thickness = 70.0;
- // filter.speed = 1.0;
-
- background.filters = [filter];
-
-}
-
-function update() {
-
- filter.update();
-
-}
diff --git a/examples/wip/filters/mengerTunnelFilter.js b/examples/wip/filters/mengerTunnelFilter.js
deleted file mode 100644
index 7e3b16137..000000000
--- a/examples/wip/filters/mengerTunnelFilter.js
+++ /dev/null
@@ -1,163 +0,0 @@
-PIXI.MengerTunnelFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: '3f', value: { x: width, y: height, z: 0 }},
- iGlobalTime: { type: '1f', value: 1 },
- iDate: { type: '4fv', value: dates },
- iChannel0: { type: 'sampler2D', value: texture, wrap: 'repeat' }
- };
-
- // Shader by fb39ca4 (https://www.shadertoy.com/view/XslGzl)
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec4 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "uniform sampler2D iChannel0;",
- "// add any extra uniforms here",
-
- "const int MAX_RAY_STEPS = 64;",
- "const float RAY_STOP_TRESHOLD = 0.0001;",
- "const int MENGER_ITERATIONS = 5;",
-
- "float maxcomp(vec2 v) { return max(v.x, v.y); }",
-
- "float sdCross(vec3 p) {",
- "p = abs(p);",
- "vec3 d = vec3(max(p.x, p.y),",
- "max(p.y, p.z),",
- "max(p.z, p.x));",
- "return min(d.x, min(d.y, d.z)) - (1.0 / 3.0);",
- "}",
-
- "float sdCrossRep(vec3 p) {",
- "vec3 q = mod(p + 1.0, 2.0) - 1.0;",
- "return sdCross(q);",
- "}",
-
- "float sdCrossRepScale(vec3 p, float s) {",
- "return sdCrossRep(p * s) / s;",
- "}",
-
- "float scene(vec3 p) {",
- "float scale = 1.0;",
- "float dist = 0.0;",
- "for (int i = 0; i < MENGER_ITERATIONS; i++) {",
- "dist = max(dist, -sdCrossRepScale(p, scale));",
- "scale *= 3.0;",
- "}",
- "return dist;",
- "}",
-
- "vec3 hsv2rgb(vec3 c)",
- "{",
- "vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);",
- "vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);",
- "return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);",
- "}",
-
- "vec4 colorize(float c) {",
-
- "float hue = mix(0.6, 1.15, min(c * 1.2 - 0.05, 1.0));",
- "float sat = 1.0 - pow(c, 4.0);",
- "float lum = c;",
- "vec3 hsv = vec3(hue, sat, lum);",
- "vec3 rgb = hsv2rgb(hsv);",
- "return vec4(rgb, 1.0);",
- "}",
-
-
- "void main(void)",
- "{",
- "vec2 screenPos = gl_FragCoord.xy / iResolution.xy * 2.0 - 1.0;",
- "vec2 mousePos = iMouse.xy / iResolution.xy * 2.0 - 1.0;",
-
- "vec3 cameraPos = vec3(0.16 * sin(iGlobalTime), 0.16 * cos(iGlobalTime), iGlobalTime);",
- "//vec3 cameraPos = vec3(0.0);",
- "vec3 cameraDir = vec3(0.0, 0.0, 1.0);",
- "vec3 cameraPlaneU = vec3(1.0, 0.0, 0.0);",
- "vec3 cameraPlaneV = vec3(0.0, 1.0, 0.0) * (iResolution.y / iResolution.x);",
-
- "vec3 rayPos = cameraPos;",
- "vec3 rayDir = cameraDir + screenPos.x * cameraPlaneU + screenPos.y * cameraPlaneV;",
-
- "rayDir = normalize(rayDir);",
-
- "float dist = scene(rayPos);",
- "int stepsTaken;",
- "for (int i = 0; i < MAX_RAY_STEPS; i++) {",
- "if (dist < RAY_STOP_TRESHOLD) {",
- "continue;",
- "}",
- "rayPos += rayDir * dist;",
- "dist = scene(rayPos);",
- "stepsTaken = i;",
- "}",
-
- "vec4 color = colorize(pow(float(stepsTaken) / float(MAX_RAY_STEPS), 0.9));",
-
- "gl_FragColor = color;",
- "}"];
-
-
-}
-
-PIXI.MengerTunnelFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.MengerTunnelFilter.prototype.constructor = PIXI.MengerTunnelFilter;
-
-Object.defineProperty(PIXI.MengerTunnelFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.iGlobalTime.value;
- },
- set: function(value) {
- this.uniforms.iGlobalTime.value = value;
- }
-});
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('texture', 'wip/tex15.png');
-
-}
-
-var filter;
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(0, 0, 'texture');
- sprite.width = 800;
- sprite.height = 600;
-
- filter = new PIXI.MengerTunnelFilter(sprite.width, sprite.height, sprite.texture);
-
- sprite.filters = [filter];
-
-}
-
-function update() {
-
- filter.iGlobalTime = game.time.totalElapsedSeconds();
-
-}
-
-function render() {
-}
diff --git a/examples/wip/filters/metaBallsFilter.js b/examples/wip/filters/metaBallsFilter.js
deleted file mode 100644
index 67cc6c5e4..000000000
--- a/examples/wip/filters/metaBallsFilter.js
+++ /dev/null
@@ -1,116 +0,0 @@
-PIXI.MetaBallsFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: '3f', value: { x: width, y: height, z: 0 }},
- iMouse: { type: '3f', value: { x: 0, y: 0, z: 0 }},
- iGlobalTime: { type: '1f', value: 1 },
- iDate: { type: '4fv', value: dates },
- iChannel0: { type: 'sampler2D', value: texture, wrap: 'repeat' }
- };
-
- // Shader by triggerHLM (https://www.shadertoy.com/view/lsfGDH)
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec4 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "uniform sampler2D iChannel0;",
- "// add any extra uniforms here",
-
- "#define stiffness 10.0 // Blobbiness factor (higher = stiffer balls)",
- "#define cfalloff 20.0 // Glow factor (higher = sharper, shorter glow)",
-
- "void main(void)",
- "{",
- "vec2 uv = gl_FragCoord.xy / iResolution.xy;",
-
- "// calculate some ball positions (sin is nice for animating)",
- "vec2 ballA = vec2(0.5+0.5*sin(iGlobalTime),0.5+0.5*cos(iGlobalTime));",
- "vec2 ballB = vec2(0.5+0.4*sin(iGlobalTime),0.5+0.4*cos(iGlobalTime*1.3));",
- "vec2 ballC = vec2(0.5+0.4*sin(iGlobalTime*2.0),0.5+0.4*cos(iGlobalTime*1.7));",
-
- "// calc range-based per-pixel values",
- "// subtract from length to make the ball bigger (every pixel closer)",
- "// clamp to avoid negative distances and fucky values",
- "// invert it so it's closeness to the ball",
- "// raise to power to sharpen the edge of the ball (more sudden falloff from 1.0)",
- "float r1 = pow(1.0-clamp(length(uv-ballA)-0.1,0.0,1.0),stiffness);",
- "float r2 = pow(1.0-clamp(length(uv-ballB)-0.05,0.0,1.0),stiffness);",
- "float r3 = pow(1.0-clamp(length(uv-ballC)-0.025,0.0,1.0),stiffness);",
-
- "// sum for blobbage!",
- "float v = r1+r2+r3;",
-
- "// calculate colour",
- "vec3 final = vec3(v,v,v);",
- "final.x = pow(v,cfalloff);",
- "final.y = pow(v,cfalloff);",
- "final.z = pow(v,cfalloff*0.4); // sharpen blue less, for a blue glow",
-
- "// gimme some pixels baby!",
- "gl_FragColor = vec4(final,1.0);",
- "}"];
-
-}
-
-PIXI.MetaBallsFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.MetaBallsFilter.prototype.constructor = PIXI.MetaBallsFilter;
-
-Object.defineProperty(PIXI.MetaBallsFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.iGlobalTime.value;
- },
- set: function(value) {
- this.uniforms.iGlobalTime.value = value;
- }
-});
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('texture', 'wip/tex07.jpg');
-
-}
-
-var filter;
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(0, 0, 'texture');
- sprite.width = 800;
- sprite.height = 600;
-
- filter = new PIXI.MetaBallsFilter(sprite.width, sprite.height, sprite.texture);
-
- sprite.filters = [filter];
-
-}
-
-function update() {
-
- filter.iGlobalTime = game.time.totalElapsedSeconds();
- filter.uniforms.iMouse.value.x = game.input.x;
- filter.uniforms.iMouse.value.y = game.input.y;
-
-}
-
-function render() {
-}
diff --git a/examples/wip/filters/mouseStarFilter.js b/examples/wip/filters/mouseStarFilter.js
deleted file mode 100644
index cbf7bf23e..000000000
--- a/examples/wip/filters/mouseStarFilter.js
+++ /dev/null
@@ -1,100 +0,0 @@
-PIXI.MouseStarFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: 'f3', value: { x: width, y: height, z: 0 }},
- iMouse: { type: 'f3', value: { x: 0, y: 0, z: 0 }},
- iGlobalTime: { type: 'f', value: 1 },
- iDate: { type: 'f4', value: dates },
- iChannel0: { type: 'sampler2D', value: texture, wrap: 'repeat' }
- };
-
- // Shader by Danguafer (https://www.shadertoy.com/view/XdB3zw)
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec3 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "uniform sampler2D iChannel0;",
- "// add any extra uniforms here",
-
- "#define t iGlobalTime/4.0",
-
- "void main(void) {",
- "vec2 p = (2.0*gl_FragCoord.xy-iResolution.xy)/iResolution.y;",
- "vec2 mp = iMouse.xy/iResolution.xy*0.5+0.5;",
-
- "float s = 1.0;",
- "for (int i=0; i < 7; i++) {",
- "s = max(s,abs(p.x)-0.375);",
- "p = abs(p*2.25)-mp*1.25;",
- "p *= mat2(cos(t),-sin(t),sin(t),cos(t));",
- "}",
-
- "vec3 col = vec3(4.0,2.0,1.0)/abs(atan(p.y,p.x))/s;",
-
- "gl_FragColor = vec4(col,1.0);",
- "}"];
-
-}
-
-PIXI.MouseStarFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.MouseStarFilter.prototype.constructor = PIXI.MouseStarFilter;
-
-Object.defineProperty(PIXI.MouseStarFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.iGlobalTime.value;
- },
- set: function(value) {
- this.uniforms.iGlobalTime.value = value;
- }
-});
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('texture', 'wip/tex00.jpg');
-
-}
-
-var filter;
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(0, 0, 'texture');
- sprite.width = 800;
- sprite.height = 600;
-
- filter = new PIXI.MouseStarFilter(sprite.width, sprite.height, sprite.texture);
-
- sprite.filters = [filter];
-
-}
-
-function update() {
-
- filter.iGlobalTime = game.time.totalElapsedSeconds();
- filter.uniforms.iMouse.value.x = game.input.x;
- filter.uniforms.iMouse.value.y = game.input.y;
-
-}
-
-function render() {
-}
diff --git a/examples/wip/filters/mysteryVortexFilter.js b/examples/wip/filters/mysteryVortexFilter.js
deleted file mode 100644
index c8915bc7e..000000000
--- a/examples/wip/filters/mysteryVortexFilter.js
+++ /dev/null
@@ -1,95 +0,0 @@
-PIXI.MysteryVortexFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: '3f', value: { x: width, y: height, z: 0 }},
- iMouse: { type: '3f', value: { x: 0, y: 0, z: 0 }},
- iGlobalTime: { type: '1f', value: 1 },
- iDate: { type: '4fv', value: dates },
- iChannel1: { type: 'sampler2D', value: texture, wrap: 'repeat' }
- };
-
- // Shader by xeron_iris (https://www.shadertoy.com/view/XdXGz7)
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec4 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "uniform sampler2D iChannel0;",
- "// add any extra uniforms here",
-
- "void main(void)",
- "{",
- "vec2 uv = (gl_FragCoord.xy - (iResolution.xy/2.0)) / iResolution.xy;",
-
- "float dist = sqrt(uv.x*uv.x+uv.y*uv.y);",
-
- "float distr = ((sin(iGlobalTime)+1.0)-dist) * sin(atan(uv.x, uv.y)*7.0+iGlobalTime*4.01+sin(dist*(cos(iGlobalTime*0.3)+0.25)*40.0));",
- "float distg = ((sin(iGlobalTime*0.9)+1.0)-dist) * sin(atan(uv.x, uv.y)*8.0+iGlobalTime*3.41+sin(dist*(cos(iGlobalTime*0.25)+0.25)*40.0));",
- "float distb = ((sin(iGlobalTime*1.15)+1.0)-dist) * sin(atan(uv.x, uv.y)*9.0+iGlobalTime*4.36+sin(dist*(cos(iGlobalTime*0.33)+0.25)*40.0));",
-
- "gl_FragColor = vec4(distr+distg-distb, distg+distb-distr, distb+distr-distg, 1.0);",
- "}"];
-
-}
-
-PIXI.MysteryVortexFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.MysteryVortexFilter.prototype.constructor = PIXI.MysteryVortexFilter;
-
-Object.defineProperty(PIXI.MysteryVortexFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.iGlobalTime.value;
- },
- set: function(value) {
- this.uniforms.iGlobalTime.value = value;
- }
-});
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('texture', 'wip/tex00.jpg');
-
-}
-
-var filter;
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(0, 0, 'texture');
- sprite.width = 800;
- sprite.height = 600;
-
- filter = new PIXI.MysteryVortexFilter(sprite.width, sprite.height, sprite.texture);
-
- sprite.filters = [filter];
-
-}
-
-function update() {
-
- filter.iGlobalTime = game.time.totalElapsedSeconds();
- filter.uniforms.iMouse.value.x = game.input.x;
- filter.uniforms.iMouse.value.y = game.input.y;
-
-}
-
-function render() {
-}
diff --git a/examples/wip/filters/planeDeformationFilter.js b/examples/wip/filters/planeDeformationFilter.js
deleted file mode 100644
index ad52b55d1..000000000
--- a/examples/wip/filters/planeDeformationFilter.js
+++ /dev/null
@@ -1,116 +0,0 @@
-PIXI.PlaneDeformationFilter = function(width, height, texture)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: '3f', value: { x: width, y: height, z: 0 }},
- iMouse: { type: '3f', value: { x: 0, y: 0, z: 0 }},
- iGlobalTime: { type: '1f', value: 1 },
- iDate: { type: '4fv', value: dates },
- iChannel0: { type: 'sampler2D', value: texture, textureData: { repeat: true } }
- };
-
- // Shader by cce (https://www.shadertoy.com/view/XsXGWM)
-
-// "vec4 blips = texture2D(iChannel1, maa);",
-// "vec4 mixer = texture2D(iChannel1, maa2);",
-
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec4 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "uniform sampler2D iChannel0;",
- "// add any extra uniforms here",
-
- "void main(void)",
- "{",
- "float t = iGlobalTime;",
-
- "/*",
- "float ang = t;",
- "mat2 rotation = mat2(cos(ang), sin(ang),",
- "-sin(ang), cos(ang));",
- "*/",
-
- "vec2 uv = gl_FragCoord.xy / iResolution.xy;",
- "vec2 texcoord = gl_FragCoord.xy / vec2(iResolution.y);",
-
- "texcoord.y -= t*0.2;",
-
- "float zz = 1.0/(1.0-uv.y*1.7);",
- "texcoord.y -= zz * sign(zz);",
-
- "vec2 maa = texcoord.xy * vec2(zz, 1.0) - vec2(zz, 0.0) ;",
- "vec2 maa2 = (texcoord.xy * vec2(zz, 1.0) - vec2(zz, 0.0))*0.3 ;",
- "vec4 stone = texture2D(iChannel0, maa);",
- "vec4 blips = texture2D(iChannel0, maa);",
- "vec4 mixer = texture2D(iChannel0, maa2);",
-
- "float shade = abs(1.0/zz);",
-
- "vec3 outp = mix(shade*stone.rgb, mix(1.0, shade, abs(sin(t+maa.y-sin(maa.x))))*blips.rgb, min(1.0, pow(mixer.g*2.1, 2.0)));",
- "gl_FragColor = vec4(outp,1.0);",
- "}"];
-
-}
-
-PIXI.PlaneDeformationFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
-PIXI.PlaneDeformationFilter.prototype.constructor = PIXI.PlaneDeformationFilter;
-
-Object.defineProperty(PIXI.PlaneDeformationFilter.prototype, 'iGlobalTime', {
- get: function() {
- return this.uniforms.iGlobalTime.value;
- },
- set: function(value) {
- this.uniforms.iGlobalTime.value = value;
- }
-});
-
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.load.image('texture', 'wip/tex03.jpg');
-
-}
-
-var filter;
-var sprite;
-
-function create() {
-
- sprite = game.add.sprite(0, 0, 'texture');
- sprite.width = 800;
- sprite.height = 600;
-
- filter = new PIXI.PlaneDeformationFilter(sprite.width, sprite.height, sprite.texture);
-
- sprite.filters = [filter];
-
-}
-
-function update() {
-
- filter.iGlobalTime = game.time.totalElapsedSeconds();
- filter.uniforms.iMouse.value.x = game.input.x;
- filter.uniforms.iMouse.value.y = game.input.y;
-
-}
-
-function render() {
-}
diff --git a/examples/wip/filters/plasma3DFilter.js b/examples/wip/filters/plasma3DFilter.js
deleted file mode 100644
index 27cbfeb8c..000000000
--- a/examples/wip/filters/plasma3DFilter.js
+++ /dev/null
@@ -1,160 +0,0 @@
-PIXI.Plasma3DFilter = function(width, height)
-{
- PIXI.AbstractFilter.call( this );
-
- this.passes = [this];
-
- var d = new Date();
-
- var dates = [
- d.getFullYear(), // the year (four digits)
- d.getMonth(), // the month (from 0-11)
- d.getDate(), // the day of the month (from 1-31)
- d.getHours()*60.0*60 + d.getMinutes()*60 + d.getSeconds()
- ];
-
- this.uniforms = {
- iResolution: { type: '3f', value: { x: width, y: height, z: 0 }},
- iGlobalTime: { type: '1f', value: 1 },
- iDate: { type: '4fv', value: dates }
- };
-
- // Shader by Optimus (https://www.shadertoy.com/view/Mss3zn)
- this.fragmentSrc = [
- "precision mediump float;",
- "uniform vec3 iResolution;",
- "uniform float iGlobalTime;",
- "uniform float iChannelTime[4];",
- "uniform vec4 iMouse;",
- "uniform vec4 iDate;",
- "uniform vec3 iChannelResolution[4];",
- "// add any extra uniforms here",
-
- "// Dark Chocolate Cave Plasma by Optimus",
-
- "#ifdef GL_ES",
- "precision mediump float;",
- "#endif",
-
- "float time;",
- "vec2 mouse;",
- "vec2 resolution;",
-
- "const int iters = 256;",
-
- "const float origin_z = 0.0;",
- "const float plane_z = 4.0;",
- "const float far_z = 64.0;",
-
- "const float step = (far_z - plane_z) / float(iters) * 0.025;",
-
- "const float color_bound = 0.0;",
- "const float upper_bound = 1.0;",
-
- "const float scale = 32.0;",
-
- "const float disp = 0.25;",
-
- "float calc_this(vec3 p, float disx, float disy, float disz)",
- "{",
- "float c = sin(sin((p.x + disx) * sin(sin(p.z + disz)) + time) + sin((p.y + disy) * cos(p.z + disz) + 2.0 * time) + sin(3.0*p.z + disz + 3.5 * time) + sin((p.x + disx) + sin(p.y + disy + 2.5 * (p.z + disz - time) + 1.75 * time) - 0.5 * time));",
- "return c;",
- "}",
-
- "vec3 get_intersection()",
- "{",
- "vec2 position = (gl_FragCoord.xy / resolution.xy - 0.5) * scale;",
-
- "vec3 pos = vec3(position.x, position.y, plane_z);",
- "vec3 origin = vec3(0.0, 0.0, origin_z);",
-
- "vec3 dir = pos - origin;",
- "vec3 dirstep = normalize(dir) * step;",
-
- "dir = normalize(dir) * plane_z;",
-
-
- "float c;",
-
- "for (int i=0; i
This shader will not work as the author intended. Please consider using a WebAudio-friendly browser (Chrome).", false, null );
- me.mNoAudioMessageShowed = true;
- }
- }
- } );
-
- texture.audio.addEventListener( "error", function(e)
- {
- if( this.mForceMuted ) return;
-
- if( texture.audio.hasFalled==true ) { /*alert("Error: cannot load music" ); */return; }
- var str = texture.audio.src;
- str = str.substr(0,str.lastIndexOf('.') ) + ".ogg";
- texture.audio.src = str;
- texture.audio.hasFalled = true;
- } );
-
- if( !this.mForceMuted )
- {
- texture.audio.src = url.mSrc;
- }
-
-
- if( me.mTextureCallbackFun!=null )
- me.mTextureCallbackFun( me.mTextureCallbackObj, slot, null, false, true, 2, -1.0 );
- }
- else if( url.mType=="keyboard" )
- {
- texture = {};
- texture.mInfo = url;
- texture.globject = gl.createTexture();
- texture.loaded = true;
-
- texture.keyboard = {};
-
- texture.keyboard.mImage = new Image();
- texture.keyboard.mImage.onload = function()
- {
- texture.loaded = true;
- if( me.mTextureCallbackFun!=null )
- me.mTextureCallbackFun( me.mTextureCallbackObj, slot, {mImage:texture.keyboard.mImage,mData:texture.keyboard.mData}, false, false, 4, -1.0 );
- }
- texture.keyboard.mImage.src = "/img/keyboard.png";
-
-
- texture.keyboard.mNewTextureReady = true;
- texture.keyboard.mData = new Uint8Array( 256*2 );
-
- createKeyboardTexture( gl, texture.globject );
-
- for( var j=0; j<(256*2); j++ )
- {
- texture.keyboard.mData[j] = 0;
- }
-
- if( me.mTextureCallbackFun!=null )
- me.mTextureCallbackFun( me.mTextureCallbackObj, slot, {mImage:texture.keyboard.mImage,mData:texture.keyboard.mData}, false, false, 4, -1.0 );
- }
- else if( url.mType==null )
- {
- if( me.mTextureCallbackFun!=null )
- me.mTextureCallbackFun( this.mTextureCallbackObj, slot, null, false, true, 0, -1.0 );
- }
- else
- {
- alert( "texture type error" );
- return;
- }
-
- this.DestroyInput( slot );
- this.mInputs[slot] = texture;
-
- this.MakeHeader();
-}
-
-Effect.prototype.SetKeyDown = function( k )
-{
- for( var i=0; i ";
- }
-
- return $output;
-
- }
-?>
-
-
-
-
-
- $value2 ";
- $output .= "[ single lib ] ";
- $output .= "[ full screen ] ";
- $output .= "[ cocoon ]
-
-
-
-
";
- }
-
- return $output;
-
- }
-?>
-
-
-
-
-
- work in progress examples
-
-
-
-
";
- }
-
- return $output;
-
- }
-?>
-
-
-
-
-
- work in progress examples
-
-
-
- ShaderToy to PIXI Convertor
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/wip/misc/fixdrag.js b/examples/wip/misc/fixdrag.js
deleted file mode 100644
index e8baa82ca..000000000
--- a/examples/wip/misc/fixdrag.js
+++ /dev/null
@@ -1,72 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-
- game.stage.backgroundColor = '#007236';
-
- game.load.image('ball', 'assets/sprites/shinyball.png');
- game.load.image('mushroom', 'assets/sprites/mushroom2.png');
- game.load.image('phaser', 'assets/sprites/sonic_havok_sanity.png');
-
-}
-
-var sprite;
-var cursors;
-
-function create() {
-
- game.world.setBounds(0, 0, 1000, 1000);
-
- for (var i = 0; i < 100; i++)
- {
- game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom');
- }
-
- sprite = game.add.sprite(200, 200, 'ball');
-
- sprite.fixedToCamera = true;
- // sprite.cameraOffset.setTo(200, 200);
-
-
- sprite.inputEnabled = true;
- sprite.input.enableDrag();
- sprite.events.onInputOver.add(wibble, this);
-
- cursors = game.input.keyboard.createCursorKeys();
-
-}
-
-function wibble() {
- console.log('over');
-}
-
-function update() {
-
- if (cursors.up.isDown)
- {
- game.camera.y -= 4;
- }
- else if (cursors.down.isDown)
- {
- game.camera.y += 4;
- }
-
- if (cursors.left.isDown)
- {
- game.camera.x -= 4;
- }
- else if (cursors.right.isDown)
- {
- game.camera.x += 4;
- }
-
-}
-
-function render() {
-
- game.debug.text(sprite.cameraOffset.x, 32, 32);
- game.debug.text(sprite.cameraOffset.y, 32, 64);
- game.debug.pointer(game.input.activePointer);
-
-}
diff --git a/examples/wip/misc/forum.js b/examples/wip/misc/forum.js
deleted file mode 100644
index b7a4d2189..000000000
--- a/examples/wip/misc/forum.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var mainMenu = {
-
- preload: function () {
-
- // game.load.image('bg', 'assets/bg.png');
- // game.load.image('mainstart', 'assets/mainstart.png');
- game.load.image('bg', 'assets/pics/louie-inga.png');
- game.load.image('mainstart', 'assets/pics/contra2.png');
-
- },
-
- create: function () {
-
- game.add.sprite(0, 0, 'bg');
-
- var mainstart = game.add.sprite(0, 0, 'mainstart');
- mainstart.name = "mainstart";
- mainstart.inputEnabled = true;
- mainstart.events.onInputDown.add(this.listener, this);
-
- },
-
- listener: function ()
- {
- game.state.start('levelMenu', true, true);
- }
-
-}
-
-var levelSelect = {
-
- preload: function () {
- },
-
- create: function () {
-
- game.add.sprite(0, 0, 'bg');
-
- }
-
-}
-
-var game = new Phaser.Game(640, 480);
-
-game.state.add('menu', mainMenu, true);
-game.state.add('levelMenu', levelSelect);
-
diff --git a/examples/wip/misc/gc1.js b/examples/wip/misc/gc1.js
deleted file mode 100644
index 2c0900a6c..000000000
--- a/examples/wip/misc/gc1.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
-}
-
-function create() {
-}
-
-function update() {
-}
-
-function render() {
-}
diff --git a/examples/wip/misc/gravity.js b/examples/wip/misc/gravity.js
deleted file mode 100644
index 1268c2344..000000000
--- a/examples/wip/misc/gravity.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-
-function preload() {
- game.load.image('arrow', 'assets/sprites/arrow.png');
-
-}
-
-var sprite;
-
-var setGravityToPointXY = function(game,sprite,power, radiusLow,radiusHigh,pointX,pointY){
- var pointXY = new Phaser.Point(pointX,pointY);
- var tempDistance = Phaser.Point.distance(sprite,pointXY);
- if(tempDistance>radiusLow&&tempDistance