Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

How to stop InputListener events from persisting after screen change?

$
0
0

@Lionel_Thomas wrote:

I have successfully implemented Input Listeners but the event handlers are still hooked up after I change the screen.
My Menu screen has 5 buttons that are hooked up on mouse click. In the button event handler I check the mouse position to determine which button was clicked. Then I change screens. The event handlers still persist on the new screen so when a button is clicked on the new screen that overlaps the button on the previous screen both are fired.
Is there a way to unhook all the listeners at once when changing screens? To date I have only implemented the Input Listeners in my buttons. I have many controls and sprites where I could use this.
Hope somebody can help.

Posts: 7

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles