jeudi 5 janvier 2017

Send event from Pixi.js to Ember component

I have a canvas with an example Pixi game running inside an Ember application (I use http://ift.tt/2iKA3mZ for this):

import PixiCanvas from 'ember-cli-pixijs/components/pixi-canvas';
import PairsGame from './pairsgame';

export default PixiCanvas.extend({

  draw() {
    const renderer = this.get('pixiRenderer');
    var game = new PairsGame()
      .init(renderer)
      .preload()
      .animate();
  }

});

The example game I copied from: http://ift.tt/2iOGOGY

Now I would like to send a 'success' or 'failure' message on each turn to one of my Ember components so that I can take a certain action (e.g., simply log 'success'/'failure' to console). What are ways to accomplish that?

I tried looking at the solution here and put

Ember.Instrumentation.instrument("pixi.gameEvent", 'success');

in the Pixi code, but the subscriber seems to never receive anything.




Aucun commentaire:

Enregistrer un commentaire