use of com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider in project lionengine by b3dgs.
the class ParallaxTest method testParallax.
/**
* Test clouds.
*/
@Test
void testParallax() {
final Parallax parallax = new Parallax(new SourceResolutionProvider() {
@Override
public int getWidth() {
return 320;
}
@Override
public int getHeight() {
return 240;
}
@Override
public int getRate() {
return 60;
}
}, Medias.create("surface.png"), 11, 1, 2, 100, 100);
parallax.setScreenSize(320, 240);
parallax.update(1.0, 1, 0, 200.0);
parallax.update(1.0, 1, 200, 200.0);
parallax.update(1.0, 1, 300, 200.0);
parallax.update(1.0, 1, 0, -200.0);
parallax.update(1.0, 1, 0, -200.0);
parallax.update(1.0, 1, 0, -200.0);
final Graphic g = Graphics.createGraphic();
parallax.render(g);
g.dispose();
}
use of com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider in project lionengine by b3dgs.
the class WorldTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
services.add(new Context() {
@Override
public int getX() {
return 0;
}
@Override
public int getY() {
return 0;
}
@Override
public int getWidth() {
return 0;
}
@Override
public int getHeight() {
return 0;
}
@Override
public <T extends InputDevice> T getInputDevice(Class<T> type) {
return null;
}
@Override
public Config getConfig() {
return config;
}
});
services.add(new SourceResolutionProvider() {
@Override
public int getWidth() {
return output.getWidth();
}
@Override
public int getHeight() {
return output.getHeight();
}
@Override
public int getRate() {
return output.getRate();
}
});
services.add(new Sequencer() {
@Override
public void end(Class<? extends Sequencable> nextSequenceClass, Object... arguments) {
// Mock
}
@Override
public void end() {
// Mock
}
@Override
public void load(Class<? extends Sequencable> nextSequenceClass, Object... arguments) {
// Mock
}
@Override
public void setSystemCursorVisible(boolean visible) {
// Mock
}
});
services.add(new Rasterbar() {
@Override
public void setRasterbarY(int y1, int y2) {
// Mock
}
@Override
public void setRasterbarOffset(int offsetY, int factorY) {
// Mock
}
@Override
public void renderRasterbar() {
// Mock
}
@Override
public void clearRasterbarColor() {
// Mock
}
@Override
public void addRasterbarColor(ImageBuffer buffer) {
// Mock
}
});
}
use of com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider in project lionengine by b3dgs.
the class ExtractorModelTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
services.add(new SourceResolutionProvider() {
@Override
public int getWidth() {
return 0;
}
@Override
public int getHeight() {
return 0;
}
@Override
public int getRate() {
return 50;
}
});
services.add(new MapTileGame());
}
use of com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider in project lionengine by b3dgs.
the class CameraTest method testCameraView.
/**
* Test the camera view.
*/
@Test
void testCameraView() {
camera.setView(1, 2, 3, 4, 4);
assertEquals(1, camera.getViewX());
assertEquals(2, camera.getViewY());
assertEquals(3, camera.getWidth());
assertEquals(4, camera.getHeight());
camera.drawFov(new GraphicMock(), 0, 0, 1, 1, surface);
assertThrows(() -> camera.setView(null, 0, 0, null), "Unexpected null argument !");
camera.setView(new SourceResolutionProvider() {
@Override
public int getWidth() {
return 320;
}
@Override
public int getHeight() {
return 240;
}
@Override
public int getRate() {
return 60;
}
}, 10, 20, Origin.TOP_LEFT);
assertEquals(10, camera.getViewX());
assertEquals(20, camera.getViewY());
assertEquals(310, camera.getWidth());
assertEquals(220, camera.getHeight());
}
use of com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider in project lionengine by b3dgs.
the class ProducerModelTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
services.add(new Handler(services));
services.add(new SourceResolutionProvider() {
@Override
public int getWidth() {
return 0;
}
@Override
public int getHeight() {
return 0;
}
@Override
public int getRate() {
return 50;
}
});
producer = new ProducerModel(services, setup);
producer.prepare(object);
}
Aggregations