use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class TextAwtTest method testAlignUnknown.
/**
* Test align unknown.
*/
@Test
void testAlignUnknown() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.NORMAL);
final Graphic g = Graphics.createGraphic();
g.setGraphic(ToolsAwt.createImage(1, 1, java.awt.Transparency.OPAQUE).createGraphics());
assertThrows(() -> text.draw(g, 0, 0, Align.values()[3], Constant.EMPTY_STRING), "Unknown enum: FAIL");
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SequenceRenderer method initResolution.
/**
* Initialize resolution.
*
* @param source The resolution source (must not be <code>null</code>).
* @throws LionEngineException If invalid argument.
*/
void initResolution(Resolution source) {
Check.notNull(source);
setSystemCursorVisible(cursorVisibility.booleanValue());
this.source = source;
screen.onSourceChanged(source);
w = source.getWidth();
h = source.getHeight();
buf = Graphics.createImageBuffer(w, h);
bu = new int[w * h];
transform = getTransform();
final Graphic gbuf = buf.createGraphic();
graphic.setGraphic(gbuf.getGraphic());
scanline.prepare(config);
setDirect(h == config.getOutput().getHeight());
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteFontTest method testDraw.
/**
* Test draw.
*/
@Test
void testDraw() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
sprite.load();
sprite.draw(g, 1, 2, Align.CENTER, "az%");
g.dispose();
sprite.dispose();
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteFontTest method testRender.
/**
* Test render.
*/
@Test
void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
sprite.load();
sprite.prepare();
sprite.render(g);
sprite.setMirror(Mirror.HORIZONTAL);
sprite.setAlign(Align.RIGHT);
sprite.setText("az%");
sprite.setLocation(1.5, 2.5);
sprite.render(g);
sprite.setMirror(Mirror.VERTICAL);
sprite.setLineHeight(5);
sprite.render(g);
g.dispose();
sprite.dispose();
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteTest method testRender.
/**
* Test render.
*/
@Test
void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.render(g);
sprite.setMirror(Mirror.HORIZONTAL);
sprite.render(g);
sprite.setMirror(Mirror.VERTICAL);
sprite.render(g);
g.dispose();
}
Aggregations