use of com.b3dgs.lionengine.Config in project lionengine by b3dgs.
the class LoopFrameSkipping method getMaxFrameTimeNano.
/**
* Get the maximum frame time in nano seconds.
*
* @param screen The screen reference.
* @return The maximum frame time in nano seconds.
*/
private static double getMaxFrameTimeNano(Screen screen) {
final Config config = screen.getConfig();
final Resolution source = config.getSource();
final double expectedRate = getExpectedRate(source);
return Constant.ONE_SECOND_IN_MILLI / expectedRate * Constant.NANO_TO_MILLI;
}
use of com.b3dgs.lionengine.Config in project lionengine by b3dgs.
the class DrawableTest method testMissingDpi.
/**
* Test success cases with missing DPI.
*/
@Test
public void testMissingDpi() {
Drawable.setDpi(new Resolution(320, 240, 60), new Config(new Resolution(1920, 1200, 16), 60, false));
try {
testImage(false);
testSprite(false);
testSpriteAnimated(false, 1, 1);
testSpriteTiled(false, 1, 1);
testSpriteFont(false, 1, 1);
testSpriteParallaxed(false, 1, 1, 1);
} finally {
Drawable.setDpi(null);
}
}
use of com.b3dgs.lionengine.Config in project lionengine by b3dgs.
the class ScreenAwtTest method testWindowed.
/**
* Test windowed screen.
*/
@Test
void testWindowed() {
Medias.setLoadFromJar(ScreenAwtTest.class);
final Config config = new Config(UtilTests.RESOLUTION_320_240, 32, true, Medias.create("image.png"));
testScreen(config);
}
use of com.b3dgs.lionengine.Config in project lionengine by b3dgs.
the class ScreenHeadlessTest method testWindowed.
/**
* Test windowed screen.
*
* @throws Exception If error.
*/
@Test
void testWindowed() throws Exception {
final Config config = new Config(com.b3dgs.lionengine.UtilTests.RESOLUTION_320_240, 32, true, Medias.create(IMAGE));
assertTimeout(1000L, () -> testScreen(config));
}
use of com.b3dgs.lionengine.Config in project lionengine by b3dgs.
the class LoopFrameSkipping method hasSync.
/**
* Check if screen has sync locked.
*
* @param screen The screen reference.
* @return <code>true</code> if sync enabled, <code>false</code> else.
*/
private static boolean hasSync(Screen screen) {
final Config config = screen.getConfig();
final Resolution output = config.getOutput();
return config.isWindowed() && output.getRate() > 0;
}
Aggregations