-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add utility method to determine if Engine is paused or not #750
Comments
If you implement your game UI as all HTML this also works really well, since if the game is stopped no updates/processing will happen but HTML will work fine. |
Can I take this ? |
@SurajGoel For sure! Please do, let us know if you need any assisstance :) |
@eonarheim Sorry, didn't see your post. On it now, will update you soon. |
@eonarheim How should I write a unit test for this ? A simple idea :- Maybe run the engine first, check the status, stop the engine, check the status again. And should I put the test in Utility Functions test suite ? |
@SurajGoel Sounds like a good way to do it! You'll probably want to test that it can be un-paused as well. This is Now that I'm thinking about it, this is more of a test of the |
- Added a function isPaused to check the running status of Engine into Engine.ts Resolves: excaliburjs#750
Closes #750 ## Changes: - Added a function isPaused to check the running status of Engine into Engine.ts
Context
Currently, you can stop/start (i.e. pause/resume) a game with
Engine.start()
andEngine.stop()
. However, in order to implement pause logic, you need to manage your own boolean:Proposal
The
Engine
already has a private_hasStarted
variable that appears to be maintaining, but not exposing, this status.It would be helpful to have an
isStopped()
orisPaused()
method to return the current state of the game, so the above code could be simplified to:The text was updated successfully, but these errors were encountered: