Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phaser Game.destroy is broken. #1092

Closed
eguneys opened this issue Aug 6, 2014 · 7 comments
Closed

Phaser Game.destroy is broken. #1092

eguneys opened this issue Aug 6, 2014 · 7 comments

Comments

@eguneys
Copy link
Contributor

eguneys commented Aug 6, 2014

I am trying to destroy the Phaser game via Game.destroy but console chokes with errors. I am guessing because Phaser doesn't remove window event listeners properly.

I've asked this question on forum: http://www.html5gamedevs.com/topic/8363-how-to-destroy-phaser-game-properly/

This guy has the same problem and fixed it himself: http://www.html5gamedevs.com/topic/7280-phaser-window-and-document-scale-event-listeners-problem/

photonstorm added a commit that referenced this issue Aug 28, 2014
…ers, which are no longer created anonymously (thanks @eguneys #1092)

Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
SinglePad.destroy now clears all associated GamepadButton objects and signals.
@photonstorm
Copy link
Collaborator

Could you please test out the dev branch, which has lots of fixes for this in.

@eguneys
Copy link
Contributor Author

eguneys commented Aug 29, 2014

The only problem now, is when i destroy the game, previous playing audio keeps playing. Do i have to manually destroy it, I tried it within the shutdown method of states, but it is not called when the game is destroyed. Also state has no destroy method. Other than that i see no console errors.

photonstorm added a commit that referenced this issue Aug 29, 2014
…unds and reset any callbacks.

StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
@photonstorm
Copy link
Collaborator

Ok try the latest update.

@eguneys
Copy link
Contributor Author

eguneys commented Aug 29, 2014

Sweet, checkout my latest game, change the route to see audio stop.

But, yet build folder didn't include the latest changes, i had to build the project manually and use the dist folder, am i supposed to do that?

@photonstorm
Copy link
Collaborator

Yes you're supposed to do that, I rarely commit builds when working on dev.

@eguneys
Copy link
Contributor Author

eguneys commented Aug 31, 2014

@photonstorm it doesn't remove the canvas on destroy.

@photonstorm
Copy link
Collaborator

It does now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants