当前位置: 首页>>代码示例>>Java>>正文


Java GameScene类代码示例

本文整理汇总了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;
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:4,代码来源:GameController.java

示例2: getGameScene

import com.almasb.fxgl.scene.GameScene; //导入依赖的package包/类
public final GameScene getGameScene() {
    return playState.getGameScene();
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:4,代码来源:GameApplication.java

示例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);
	}
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:55,代码来源:MainScene.java


注:本文中的com.almasb.fxgl.scene.GameScene类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。