Input events

Recommended Posts

I draw all the game objects (images, animations, fonts) using renderTexture in State.Update(). 
Is there any way to handle mouse events? Without adding to the stage.

Simple example, events don't work:

public create(): void {
  let self = this;
  this.texture = this.game.add.renderTexture(this.game.width, this.game.height);
  this.game.add.sprite(0, 0, this.texture);

  this.image = this.parentGame.game.make.sprite(0, 0, this.filename);
  this.image.inputEnabled = true;
  this.image.input.useHandCursor = true;
  this.image.events.onInputDown.add(function () {
    if (self.onMouseEvent) {

public update(): void {
  this.texture.renderXY(this.image, 0, 0, this.clearBeforeDraw);


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.