Viewport now scales with window seamlessly -- though the emulator is still unusable in this state, this shows how fast the video scaling is in JavaFX compared to Swing.

This commit is contained in:
Brendan Robert 2015-02-03 01:08:11 -06:00
parent 0ccb63558f
commit e8b23c3f7a
2 changed files with 12 additions and 5 deletions

View File

@ -7,10 +7,12 @@
package jace;
import jace.core.Video;
import java.net.URL;
import javafx.scene.canvas.Canvas;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;
/**
@ -19,19 +21,24 @@ import javafx.scene.layout.Region;
*/
public class JaceUIController {
@FXML
private ResourceBundle resources;
private URL location;
@FXML
private AnchorPane rootPane;
@FXML
private Region notificationRegion;
@FXML
private ImageView appleScreen;
@FXML
public void initialize() {
void initialize() {
assert rootPane != null : "fx:id=\"rootPane\" was not injected: check your FXML file 'JaceUI.fxml'.";
assert notificationRegion != null : "fx:id=\"notificationRegion\" was not injected: check your FXML file 'JaceUI.fxml'.";
assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'.";
appleScreen.fitWidthProperty().bind(rootPane.widthProperty());
appleScreen.fitHeightProperty().bind(rootPane.heightProperty());
}
public void connectScreen(Video video) {

View File

@ -8,7 +8,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="384.0" prefWidth="560.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="384.0" prefWidth="560.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
<children>
<Region fx:id="notificationRegion" prefHeight="50.0" prefWidth="510.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="5.0" />
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />