本文整理汇总了Java中com.almasb.fxgl.scene.GameScene类的典型用法代码示例。如果您正苦于以下问题:Java GameScene类的具体用法?Java GameScene怎么用?Java GameScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameScene类属于com.almasb.fxgl.scene包,在下文中一共展示了GameScene类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GameController
import com.almasb.fxgl.scene.GameScene; //导入依赖的package包/类
public GameController(GameScene gameScene) {
this.gameScene = gameScene;
}
示例2: getGameScene
import com.almasb.fxgl.scene.GameScene; //导入依赖的package包/类
public final GameScene getGameScene() {
return playState.getGameScene();
}
示例3: MainScene
import com.almasb.fxgl.scene.GameScene; //导入依赖的package包/类
/**
* Constructor for MainScene
*/
public MainScene(int width, int height, GameScene gameScene) {
screen_width = width;
screen_height = height;
this.gameScene = gameScene;
sceneWidth = new SimpleDoubleProperty(width);
sceneHeight = new SimpleDoubleProperty(height - TAB_PANEL_HEIGHT);
isMainSceneDoneLoading = false;
if (gameScene != null) {
stage = ((Stage) gameScene.getRoot().getScene().getWindow());
isFXGL = true;
//stage.initStyle(StageStyle.DECORATED);
}
else
stage = new Stage();
stage.getIcons().add(new Image(this.getClass().getResource("/icons/lander_hab64.png").toExternalForm()));
stage.setMinWidth(sceneWidth.get());
stage.setMinHeight(sceneHeight.get());
stage.setFullScreenExitHint(
"Use Ctrl+F (or Meta+C in macOS) to toggle between either the Full Screen mode and the Window mode");
stage.setFullScreenExitKeyCombination(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN));
// Detect if a user hits the top-right close button
stage.setOnCloseRequest(e -> {
if (isFXGL) {
Input input = FXGL.getInput();
input.mockKeyPress(KeyCode.ESCAPE);
input.mockKeyRelease(KeyCode.ESCAPE);
}
else {
dialogOnExit();
e.consume();
}
});
stage.iconifiedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
if (!t.equals(t1)) {
minimized = t1;
}
}
});
// Detect if a user hits ESC
if (!isFXGL) {
esc = new ESCHandler();
setEscapeEventHandler(true, stage);
}
}