use of javafx.scene.shape.Rectangle in project FXGL by AlmasB.
the class NoiseSample method initUI.
@Override
protected void initUI() {
rect = new Rectangle(100, 100);
rect.setTranslateX(350);
Line l1 = new Line(0, Y_MAX, 500, Y_MAX);
Line l2 = new Line(X_MAX, 0, X_MAX, 600);
getGameScene().addUINodes(rect, l1, l2);
}
use of javafx.scene.shape.Rectangle in project FXGL by AlmasB.
the class FXGLDefaultMenu method createBackground.
@Override
protected Node createBackground(double width, double height) {
Rectangle bg = new Rectangle(width, height);
bg.setFill(Color.rgb(10, 1, 1));
return bg;
}
use of javafx.scene.shape.Rectangle in project FXGL by AlmasB.
the class FXGLDefaultMenu method createTitleView.
@Override
protected Node createTitleView(String title) {
Text text = FXGL.getUIFactory().newText(title, 50);
Rectangle bg = new Rectangle(text.getLayoutBounds().getWidth() + 20, 60, null);
bg.setStroke(Color.WHITE);
bg.setStrokeWidth(2);
StackPane titleRoot = new StackPane();
titleRoot.getChildren().addAll(bg, text);
titleRoot.setTranslateX(app.getWidth() / 2 - (text.getLayoutBounds().getWidth() + 20) / 2);
titleRoot.setTranslateY(50);
return titleRoot;
}
use of javafx.scene.shape.Rectangle in project FXGL by AlmasB.
the class RangeTest method onUpdate.
@Override
protected void onUpdate(double tpf) {
List<Entity> list = getGameWorld().getEntitiesInRange(player.getBoundingBoxComponent().range(40, 40));
list.forEach(e -> {
if (e == markers)
return;
EntityView view = e.getComponent(ViewComponent.class).getView();
view.getNodes().stream().map(n -> (Rectangle) n).forEach(r -> r.setFill(Color.YELLOW));
});
List<Entity> list2 = getGameWorld().getEntitiesCopy();
list2.removeAll(list);
list2.forEach(e -> {
EntityView view = e.getComponent(ViewComponent.class).getView();
view.getNodes().stream().map(n -> (Rectangle) n).forEach(r -> r.setFill(Color.BLACK));
});
}
use of javafx.scene.shape.Rectangle in project FXGL by AlmasB.
the class RangeTest method getMarker.
private Rectangle getMarker(double x, double y) {
Rectangle rect = new Rectangle(40, 40, null);
rect.setTranslateX(x);
rect.setTranslateY(y);
rect.setStroke(Color.RED);
return rect;
}
Aggregations