use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class MapTileRasteredModel method loadSheets.
/*
* MapTileRastered
*/
@Override
public void loadSheets(Media rasterConfig, boolean smooth) {
final Collection<Integer> sheets = map.getSheets();
final Iterator<Integer> itr = sheets.iterator();
final int th = map.getTileHeight();
while (itr.hasNext()) {
final Integer sheet = itr.next();
final RasterImage raster = new RasterImage(map.getSheet(sheet).getSurface(), rasterConfig, th, smooth);
raster.loadRasters(map.getTileHeight(), false, sheet.toString());
final List<SpriteTiled> rastersSheet = getRasters(sheet);
for (final ImageBuffer bufferRaster : raster.getRasters()) {
final SpriteTiled sheetRaster = Drawable.loadSpriteTiled(bufferRaster, map.getTileWidth(), th);
rastersSheet.add(sheetRaster);
}
}
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class MapTileRasteredModel method renderTile.
@Override
public void renderTile(Graphic g, MapTile map, Tile tile, int x, int y) {
final Integer sheet = tile.getSheet();
final int number = tile.getNumber();
final SpriteTiled raster = getRasterSheet(sheet, getRasterIndex(tile.getInTileY()));
raster.setLocation(x, y);
raster.setTile(number);
raster.render(g);
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testEquals.
/**
* Test equals.
*/
@Test
public void testEquals() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteTiled sprite = new SpriteTiledImpl(surface, 16, 8);
final SpriteTiled spriteMedia = new SpriteTiledImpl(media, 16, 8);
spriteMedia.load();
Assert.assertEquals(sprite, sprite);
Assert.assertEquals(sprite, new SpriteTiledImpl(surface, 16, 8));
Assert.assertEquals(spriteMedia, spriteMedia);
Assert.assertNotEquals(sprite, null);
Assert.assertNotEquals(sprite, new Object());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(media, 16, 8));
Assert.assertNotEquals(spriteMedia, new SpriteTiledImpl(media, 16, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(surface, 16, 16));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 32), 16, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 64), 16, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 64), 16, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 8, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 16));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 32), 8, 8));
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 64), 16, 16));
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testLoadMedia.
/**
* Test load with media.
*/
@Test
public void testLoadMedia() {
final SpriteTiled sprite = new SpriteTiledImpl(media, 16, 8);
sprite.load();
Assert.assertNotNull(sprite.getSurface());
sprite.prepare();
sprite.dispose();
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testMirror.
/**
* Test mirror.
*/
@Test
public void testMirror() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
Assert.assertEquals(Mirror.NONE, sprite.getMirror());
sprite.setMirror(Mirror.HORIZONTAL);
Assert.assertEquals(Mirror.HORIZONTAL, sprite.getMirror());
}
Aggregations