package tests;

import java.util.Arrays;
import java.util.List;

import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;

import com.jme3.app.SimpleApplication;
import com.jme3x.jfx.JmeFxContainer;

public class TestJavaFXAlpha2 extends SimpleApplication {

	private static Group root;

	public static void main(String[] args) {
		new TestJavaFXAlpha2().start();
	}

	@Override
	public void simpleInitApp() {
		this.setPauseOnLostFocus(false);
		this.flyCam.setDragToRotate(true);
		final JmeFxContainer jmefx = JmeFxContainer.install(this, getGuiNode(), true, null);
		Platform.runLater(new Runnable() {

			@Override
			public void run() {
				jmefx.setScene(createScene(), root);
			}
		});

		this.guiNode.attachChild(jmefx.getJmeNode());
	}

	public static Scene createScene() {

		root = new Group();

		Scene scene = new Scene(root, 600, 600, true);
		scene.setFill(new Color(0, 0, 0, 0));

		List<BackgroundFill> colors = Arrays.asList(new BackgroundFill(Color.BLACK, null, null));
		List<BackgroundImage> images = Arrays.asList(new BackgroundImage(new Image("http://i...content-available-to-author-only...r.com/7cJy8nk.png"), null, null, null, null));

		VBox container = new VBox();
		container.prefWidthProperty().bind(scene.widthProperty());
		container.prefHeightProperty().bind(scene.heightProperty());
		container.setBackground(new Background(colors, images));

		root.getChildren().add(container);

		return scene;
	}
}
