use of com.almasb.fxgl.texture.Texture in project FXGL by AlmasB.
the class QuadSample method onUpdate.
@Override
protected void onUpdate(double tpf) {
Texture t = originals.get(j);
t.setImage(textures2.get(j).getImage());
if (j > 0) {
originals.get(j - 1).setImage(textures.get(j - 1).getImage());
}
j++;
if (j == 10) {
j = 0;
}
}
use of com.almasb.fxgl.texture.Texture in project FXGL by AlmasB.
the class BasicGameApp2 method initUI.
@Override
protected void initUI() {
Text textPixels = new Text();
// x = 50
textPixels.setTranslateX(50);
// y = 100
textPixels.setTranslateY(100);
textPixels.textProperty().bind(getGameState().intProperty("pixelsMoved").asString());
// add to the scene graph
getGameScene().addUINode(textPixels);
Texture brickTexture = getAssetLoader().loadTexture("brick.png");
brickTexture.setTranslateX(50);
brickTexture.setTranslateY(450);
getGameScene().addUINode(brickTexture);
}
use of com.almasb.fxgl.texture.Texture in project FXGL by AlmasB.
the class BasicGameApp3 method initUI.
@Override
protected void initUI() {
Text textPixels = new Text();
// x = 50
textPixels.setTranslateX(50);
// y = 100
textPixels.setTranslateY(100);
textPixels.textProperty().bind(getGameState().intProperty("pixelsMoved").asString());
// add to the scene graph
getGameScene().addUINode(textPixels);
Texture brickTexture = getAssetLoader().loadTexture("brick.png");
brickTexture.setTranslateX(50);
brickTexture.setTranslateY(450);
getGameScene().addUINode(brickTexture);
}
use of com.almasb.fxgl.texture.Texture in project FXGL by AlmasB.
the class InterpolatorSample2 method initGame.
@Override
protected void initGame() {
int i = 0;
for (Interpolators interpolator : Interpolators.values()) {
Text t = getUIFactory().newText(interpolator.toString() + ":");
t.setFill(Color.BLACK);
Pane p = new Pane(t);
p.setTranslateY(i * 50 + 25);
Line line = new Line(0, i * 50, getWidth(), i * 50);
line.setStroke(Color.RED);
getGameScene().addUINodes(p, line);
Texture texture = DSLKt.texture("bird.png").toAnimatedTexture(2, Duration.seconds(0.5));
Entity bird = Entities.builder().at(100, i * 50).viewFromNode(texture).buildAndAttach();
Entities.animationBuilder().interpolator(interpolator.EASE_OUT()).duration(Duration.seconds(2)).repeatInfinitely().translate(bird).from(new Point2D(100, i * 50)).to(new Point2D(400, i * 50)).buildAndPlay();
i++;
}
}
use of com.almasb.fxgl.texture.Texture in project FXGL by AlmasB.
the class AssetsSample method approach1.
private void approach1() {
// load texture
Texture brickTexture = getAssetLoader().loadTexture("brick.png");
Entity brick = new Entity();
brick.setPosition(100, 300);
// set texture as main view
brick.setView(brickTexture);
getGameWorld().addEntity(brick);
}
Aggregations