1
0
mirror of https://github.com/aNNiMON/HotaruFX.git synced 2024-09-19 14:14:21 +03:00

Add default composition

This commit is contained in:
Victor 2017-08-24 12:19:31 +03:00
parent fb494fc080
commit 28c40a8949
2 changed files with 52 additions and 1 deletions

View File

@ -1,4 +1,24 @@
package com.annimon.hotarufx;
public class Main {
import com.annimon.hotarufx.visual.Composition;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import lombok.val;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
val group = new Group();
val composition = new Composition(1280, 720, Color.WHITE, group);
primaryStage.setTitle("HotaruFX");
primaryStage.setScene(composition.getScene());
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -0,0 +1,31 @@
package com.annimon.hotarufx.visual;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.paint.Paint;
import lombok.Getter;
public class Composition {
@Getter
private final Group group;
@Getter
private final Scene scene;
@Getter
private final int width, height;
public Composition(int width, int height, Paint background, Group group) {
this.width = width;
this.height = height;
this.group = group;
this.scene = new Scene(group, width, height, background);
}
public void add(Node node) {
group.getChildren().add(node);
}
}