简体   繁体   English

在暂停libgdx上的游戏时暂停计时器中的任务

[英]Pause a task in a timer on when pausing game on libgdx

How do I pause task in timer when game is paused on libgdx? 当游戏暂停在libgdx上时,如何在计时器中暂停任务? when I pause the game. 当我暂停游戏时 All animations stop, but the timer keeps run its sceduled task. 所有动画都会停止,但计时器会继续运行其已完成的任务。

It looks like Timer.stop() will "pause" the timer, and .start() will resume calculating the delays (odd that they're not called "pause" and "resume", though). 看起来Timer.stop()将“暂停”计时器,而.start()将继续计算延迟(奇怪的是它们不被称为“暂停”和“恢复”)。 You'll want to call these in your ApplicationListener's pause and resume callbacks. 您需要在ApplicationListener的pauseresume回调中调用它们。

If you're using the static Timer.schedule() methods, you'll want to stop/start the Timer.instance static public instance. 如果您正在使用静态Timer.schedule()方法,则需要停止/启动Timer.instance静态公共实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM