Giter Club home page Giter Club logo

phaser-inspector's Introduction

Phaser Inspector Plugin

[UPDATE] Phaser Inspector Plugin would be redesign and restructure soon to reborn as a better plugin.

[UPDATE] Phaser Inspector Plugin now support RenderTexture on WebGL.

Phaser Inspector Plugin allows you to inspect your (or someone else) Phaser game.

Floating, resizable and minimizableIntelligent Inspector with object tree, search and edit, state control and bounds drawing

The plugin is written using Angular.js and ES6, compiled with Babel and Browserify, tested on Phaser 2.1.3 and Phaser 2.4.3 running on Google Chrome Version 45.0.2454.85 (64-bit) on OSX Yosemite.

Working features:

  • Display objects tree inspection.
  • Display object class guessing.
  • Display object name guessing (by looking for this./name/ in parents).
  • Text as name for Phaser.Text.
  • Display objects non-case-sensitive search by name and class.
  • Display object destroy/kill/hide.
  • Properties inspection and editting.
  • Texture display for sprite/image
  • Bounds drawing
  • States list and state change
  • Floating, resizable and draggable panel
  • Panel remember position on page reload
  • Close/minimize panel
  • Play/Pause button

Upcoming features:

  • Transparent/Clickthrough panel
  • Sprite/Image load Texture
  • Optimize when displaying too many display objects on the tree

Feel free to follow me on twitter @netcell and check out my blog!

Demo

Check the example folder (please run bower install before that, and serve the folder on a server/localhost) or try that example rightaway on this codepen.

Download

The source is available for download from latest release or by cloning the repository or download the files in build folder. Alternatively, you can install via:

  • bower: bower install --save phaser-inspector

Usage

NOTE: I have only tested this plugin on Google Chrome so I am not sure how this would perform on other browsers. Also since this plugin is for debugging your game, you should not expect to use it on your mobile devices, meaning remove it (or conditionally not loading it) when deploying to mobile devices.

Simply download the phaser-inspector.js or phaser-inspector.min.js script from latest release and include it on your page after including Phaser:

<script src="phaser.js"></script>
<script src="phaser-inspector.js"></script>

In the create method in your boot state:

game.plugins.add(Phaser.Plugin.Inspector);

Alternatively, when running a game in the browser, you can inject the plugin in the developer console as follow:

var script = document.createElement('script'); script.src = "http://netcell.github.io/phaser-inspector/build/phaser-inspector.js"; document.getElementsByTagName('head')[0].appendChild(script); function phaserInspectorInject(){ if (Phaser.Plugin.Inspector) Phaser.GAMES[0].plugins.add(Phaser.Plugin.Inspector); else setTimeout(phaserInspectorInject); } setTimeout(phaserInspectorInject);

Check the example in example folder to see it in action :)

License

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

phaser-inspector's People

Contributors

netcell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.