Sign in to follow this  
Brad P. Taylor

Input system setCapture/releaseCapture support?

Recommended Posts

Hello Everyone,


This is a question, possible answer and a feature request all rolled into one.


First the question:


For my UI I need a way to set a specific sprite (or set of sprites) to be the only ones with active inputHandlers, Basically setCapture/releaseCapture... I spent a fair amount of time looking over the input system and didn't see this feature? 


My 'answer'


This code adds setCapture, releaseCapture and getCapture to the Phaser.Input class.


setCapture takes a single inputHandler or an array of them and will push the currently active notion of interactiveItems making the arguments the current set of interactive elements. The releaseCapture method restores things to the state before the push and of course getCapture returns the inputHandlers that have captured input.


The feature request


My hack works enough for now, but it seems clunky and woe to me if I ever need enable/disable sprite inputs while inside a capture mode. A more robust event bubbling system for sprites (and groups), would be really handy.  I know this isn't a trivial request but it would probably make things easier for making certain types of UI.







Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.