GithubHelp home page GithubHelp logo

frialex / coquette-inspect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomasboyt/coquette-inspect

0.0 1.0 0.0 68 KB

A Chrome DevTools extension for inspecting games made with the Coquette framework

JavaScript 94.43% HTML 1.01% CSS 4.56%

coquette-inspect's Introduction

coquette-inspect Stories in Ready

A Chrome DevTools extension for inspecting games made with the Coquette framework.

The inspector in action in the spinning shapes demo.

Features

  • List entities currently in the game world
  • Inspect the properties of entities as they update
  • Change the properties of entities
  • Play/pause the game loop
  • Step through the game loop

Installing

To install:

git clone [email protected]:thomasboyt/coquette-inspect.git
cd coquette-inspect/
npm install && ./node_modules/.bin/webpack

Then load the chrome-extension folder as an unpacked extension (see this guide).

If it worked, you should see a "Coquette" tab in your developer tools when you next open them.

Usage

There are two modifications you'll need to do to your Coquette apps to make them work.

Exposing Coquette

The most important one is that you expose the Coquette instance in your game as window.__coquette__, e.g.:

var Game = function() {
  window.__coquette__ = this.c = new Coquette(this, "canvas", 500, 150, "#000");
// ...

Without this, the inspector won't be able to find your Coquette instance.

Entity display names

To display your entities with their proper names (i.e. their constructors), one of two of the following need to be true:

If your constructors are defined with the syntax function Foo() {...}, the name will be looked up with entity.constructor.name. This doesn't work if your function is anonymous, e.g. var Foo = function() {...}, because that's just how function.name works. See [MDN] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name) for more detail on this weird quirk.

Otherwise, you can set the displayName property on your entity. You can either set it inside the constructor (e.g. this.displayName = 'Person'), or inside the call to entities.create (e.g. c.entities.create(Person, {displayName: 'Player'})).

coquette-inspect's People

Contributors

thomasboyt avatar waffle-iron avatar

Watchers

 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.