package com.imyeyu.fx.ui.examples.view;

import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.examples.bean.Config;
import com.imyeyu.fx.ui.examples.component.RootLayout;
import com.imyeyu.inject.annotation.Inject;
import javafx.application.Application;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

/**
 * 主界面
 *
 * @author 夜雨
 * @since 2022-05-03 14:53
 */
public abstract class ViewMain extends Application implements TimiFXUI {

	@Inject
	protected Config config;

	@Inject
	private RootLayout root;

	@Override
	public void start(final Stage stage) {
		Scene scene = new Scene(root);
		TimiFXUI.applyStyle(scene);
		stage.setTitle(TimiFXUI.MULTILINGUAL.text("fx.example.title"));
		stage.getIcons().add(new Image(RESOURCE + "icon.png"));
		stage.setScene(scene);
		stage.setWidth(config.getWidth().get());
		stage.setHeight(config.getHeight().get());
		stage.show();
	}
}
