use of com.b3dgs.lionengine.Timing in project lionengine by b3dgs.
the class ScreenAbstract method awaitReady.
@Override
public final void awaitReady() {
final Timing timeout = new Timing();
timeout.start();
while (!isReady()) {
if (timeout.elapsed(getReadyTimeOut())) {
throw new LionEngineException(ERROR_SCREEN_READY);
}
try {
Thread.sleep(Constant.DECADE);
} catch (final InterruptedException exception) {
Thread.currentThread().interrupt();
throw new LionEngineException(exception, ERROR_SCREEN_READY);
}
}
}
use of com.b3dgs.lionengine.Timing in project lionengine by b3dgs.
the class UtilSequenceTest method testPauseInterrupted.
/**
* Test pause interrupted.
*/
@Test
public void testPauseInterrupted() {
final Timing timing = new Timing();
timing.start();
final Thread thread = new Thread() {
@Override
public void run() {
UtilSequence.pause(Constant.THOUSAND);
}
};
thread.start();
thread.interrupt();
Assert.assertTrue(String.valueOf(timing.elapsed()), timing.elapsed() < Constant.THOUSAND);
}
Aggregations