cnwerb Posted December 18, 2016 Share Posted December 18, 2016 Hey guys, Does anyone know how to trigger a custom context menu to appear when a sprite is right clicked? I've had a look everywhere but can't find any clues as to how this can be done. Quote Link to comment Share on other sites More sharing options...
SET001 Posted December 19, 2016 Share Posted December 19, 2016 Something like this to handle right mouse click: this.game.input.onDown.add((pointer: Phaser.Pointer, x: number, y: number)=>{ if (pointer.rightButton.isDown){ // .. draw menu at x, y } }) but still you need you'r own stuff to draw custom menu. Also you may want to disable default right click menu: this.game.canvas.oncontextmenu = (e) => e.preventDefault() Quote Link to comment Share on other sites More sharing options...
cnwerb Posted December 19, 2016 Author Share Posted December 19, 2016 26 minutes ago, SET001 said: Something like this to handle right mouse click: this.game.input.onDown.add((pointer: Phaser.Pointer, x: number, y: number)=>{ if (pointer.rightButton.isDown){ // .. draw menu at x, y } }) but still you need you'r own stuff to draw custom menu. Also you may want to disable default right click menu: this.game.canvas.oncontextmenu = (e) => e.preventDefault() What is Phaser.Pointer in this context? Quote Link to comment Share on other sites More sharing options...
SET001 Posted December 19, 2016 Share Posted December 19, 2016 this is where click action triggered - http://phaser.io/docs/2.4.2/Phaser.Pointer.html Quote Link to comment Share on other sites More sharing options...
cnwerb Posted December 20, 2016 Author Share Posted December 20, 2016 13 hours ago, SET001 said: this is where click action triggered - http://phaser.io/docs/2.4.2/Phaser.Pointer.html But I'm using pixi, not phaser Quote Link to comment Share on other sites More sharing options...
cnwerb Posted January 13, 2017 Author Share Posted January 13, 2017 Anybody else can help with this? I still have not found a solution. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.