本文整理汇总了Java中com.jme3.niftygui.NiftyJmeDisplay类的典型用法代码示例。如果您正苦于以下问题:Java NiftyJmeDisplay类的具体用法?Java NiftyJmeDisplay怎么用?Java NiftyJmeDisplay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NiftyJmeDisplay类属于com.jme3.niftygui包,在下文中一共展示了NiftyJmeDisplay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void initialize(){
super.initialize();
System.out.println("Initialize");
RootNodeState state = new RootNodeState();
viewPort.attachScene(state.getRootNode());
stateManager.attach(state);
Spatial model = assetManager.loadModel("Models/Teapot/Teapot.obj");
model.scale(3);
model.setMaterial(assetManager.loadMaterial("Interface/Logo/Logo.j3m"));
state.getRootNode().attachChild(model);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
niftyDisplay.getNifty().fromXml("Interface/Nifty/HelloJme.xml", "start");
guiViewPort.addProcessor(niftyDisplay);
}
示例2: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
geom.setMaterial(mat);
rootNode.attachChild(geom);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
nifty = niftyDisplay.getNifty();
URL url = Thread.currentThread().getContextClassLoader().getResource("jme3test/niftygui/hellojme.xml");
nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this);
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
// disable the fly cam
// flyCam.setEnabled(false);
flyCam.setDragToRotate(true);
}
示例3: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void initialize(AppStateManager stateManager, Application app) {
if (niftyXmlPath != null) {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(),
app.getInputManager(),
app.getAudioRenderer(),
app.getGuiViewPort());
nifty = niftyDisplay.getNifty();
nifty.fromXmlWithoutStartScreen(niftyXmlPath);
app.getGuiViewPort().addProcessor(niftyDisplay);
}
for (CinematicEvent cinematicEvent : cinematicEvents) {
cinematicEvent.initEvent(app, this);
}
initialized = true;
}
示例4: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.app = (Main) app;
this.app.getFlyByCamera().setEnabled(false);
this.app.getInputManager().deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT);
this.app.getInputManager().addMapping(TOGGLE_OPTIONS, new KeyTrigger(KeyInput.KEY_ESCAPE));
this.app.getInputManager().addListener(this, TOGGLE_OPTIONS);
this.app.getInputManager().setCursorVisible(true);
niftyJmeDisplay =
new NiftyJmeDisplay(
this.app.getAssetManager(),
this.app.getInputManager(),
this.app.getAudioRenderer(),
this.app.getRenderManager().getPostView(GUIDEFAULT)
);
nifty = niftyJmeDisplay.getNifty();
this.app.getRenderManager().getPostView(GUIDEFAULT).addProcessor(niftyJmeDisplay);
nifty.fromXml("Interface/nifty/MagicallyousGUI.xml", "start");
NiftyController.registerApp(this.app);
//nifty.setDebugOptionPanelColors(true);
this.app.getInputManager().setCursorVisible(true);
}
示例5: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
app.getViewPort().attachScene(rootNode);
niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(), app.getInputManager(), app.getAudioRenderer(), app.getGuiViewPort());
Nifty nifty = niftyDisplay.getNifty();
stateManager.attach(LoginScreen.getSingleton());
nifty.fromXml("Interface/Nifty/Main.xml", "screenLogin", LoginScreen.getSingleton(), CharsScreen.getSingleton(), WorldScreen.getSingleton());
Logger.getLogger("de.lessvoid.nifty").setLevel(Level.SEVERE);
Logger.getLogger("NiftyInputEventHandlingLog").setLevel(Level.SEVERE);
app.getGuiViewPort().addProcessor(niftyDisplay);
this.app = app;
rootNode.setCullHint(CullHint.Dynamic);
}
示例6: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.app = (SimpleApplication) app; // can cast Application to something more specific
this.rootNode = this.app.getRootNode();
this.assetManager = this.app.getAssetManager();
this.stateManager = this.app.getStateManager();
this.inputManager = this.app.getInputManager();
this.guiViewPort = this.app.getGuiViewPort();
this.flyCam = this.app.getFlyByCamera();
this.timer = this.app.getTimer();
// Create and show the beginning gui display
disp = new NiftyJmeDisplay(
assetManager, inputManager, audioRenderer, guiViewPort);
nifty = disp.getNifty();
nifty.fromXml("Interface/start.xml", "start", this);
// Initialize the drop down elements that is persistent
initDropDown();
}
示例7: checkCompletion
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void checkCompletion() {
if (isCompleted()) {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
assetManager, inputManager, Main.getApp().getAudioRenderer(), Main.getApp().getGuiViewPort());
/**
* Create a new NiftyGUI object
*/
Nifty nifty = niftyDisplay.getNifty();
/**
* Read your XML and initialize your custom ScreenController
*/
nifty.fromXml("Interface/gameWon.xml", "start");
// nifty.fromXml("Interface/helloworld.xml", "start", new MySettingsScreen(data));
// attach the Nifty display to the gui view port as a processor
Main.getApp().getGuiViewPort().addProcessor(niftyDisplay);
// disable the fly cam
Main.getApp().getFlyByCamera().setDragToRotate(true);
}
}
示例8: startNifty
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
private void startNifty() {
guiNode.detachAllChildren();
niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager, audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml("Interface/ClientUI.xml", "main_menu",
new MainMenu(),
new ConnectionMenu(),
new ReplayMenu(),
new KeySetter(this, inputManager, inputSettings),
hud,
ClientSettings.getClientSettings());
guiViewPort.addProcessor(niftyDisplay);
hud.setNifty(nifty);
}
示例9: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
geom.setMaterial(mat);
rootNode.attachChild(geom);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this);
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
// disable the fly cam
// flyCam.setEnabled(false);
// flyCam.setDragToRotate(true);
inputManager.setCursorVisible(true);
}
示例10: initialize
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void initialize(AppStateManager stateManager, Application app) {
if (niftyXmlPath != null) {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(),
app.getInputManager(),
app.getAudioRenderer(),
app.getGuiViewPort());
nifty = niftyDisplay.getNifty();
nifty.fromXmlWithoutStartScreen(niftyXmlPath);
app.getGuiViewPort().addProcessor(niftyDisplay);
}
initEvent(app, this);
for (CinematicEvent cinematicEvent : cinematicEvents) {
cinematicEvent.initEvent(app, this);
}
initialized = true;
}
示例11: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void simpleInitApp() {
client.addClientStateListener(this);
client.addErrorListener(this);
assetManager.registerLocator("assets", FileLocator.class);
// Set up GUI Heads up display
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
/** Create a new NiftyGUI object */
nifty = niftyDisplay.getNifty();
nifty.loadStyleFile("nifty-default-styles.xml");
nifty.loadControlFile("nifty-default-controls.xml");
guiViewPort.addProcessor(niftyDisplay); // add to gui port
sm = new ScreenManager(nifty, inputManager,this);
sm.getHudScreenController().addObserver(this);
world = new World();
world.attachScreenManager(sm);
flyCam.setEnabled(false);
setPauseOnLostFocus(false);
}
示例12: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void simpleInitApp() {
//Set up GUI Heads up display
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, viewPort);
nifty = niftyDisplay.getNifty();
nifty.loadStyleFile("nifty-default-styles.xml");
nifty.loadControlFile("nifty-default-controls.xml");
screenManager = new ScreenManager(nifty, inputManager,this);
guiViewPort.addProcessor(niftyDisplay); //add to gui port
InputListener.addMappings(inputManager);
//Set up world
assets = assetManager;
viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f)); //just for testing purposes
setWorld2(new World());
fpsText.setText("");
rootNode.setShadowMode(ShadowMode.CastAndReceive);
setDisplayFps(false);
setDisplayStatView(false);
flyCam.setEnabled(false);
}
示例13: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void simpleInitApp() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml("all/intro.xml", "start");
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
// disable the fly cam
flyCam.setEnabled(false);
}
示例14: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
public void simpleInitApp() {
ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
niftyView.setClearFlags(true, true, true);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
niftyView);
nifty = niftyDisplay.getNifty();
nifty.fromXml("all/intro.xml", "start");
niftyView.addProcessor(niftyDisplay);
Texture2D depthTex = new Texture2D(1024, 768, Format.Depth);
FrameBuffer fb = new FrameBuffer(1024, 768, 1);
fb.setDepthTexture(depthTex);
Texture2D tex = new Texture2D(1024, 768, Format.RGBA8);
tex.setMinFilter(MinFilter.Trilinear);
tex.setMagFilter(MagFilter.Bilinear);
fb.setColorTexture(tex);
niftyView.setClearFlags(true, true, true);
niftyView.setOutputFrameBuffer(fb);
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
示例15: simpleInitApp
import com.jme3.niftygui.NiftyJmeDisplay; //导入依赖的package包/类
@Override
public void simpleInitApp() {
flyCam.setEnabled(false);
inputManager.deleteMapping(INPUT_MAPPING_EXIT);
Geometry jmeGeometry = new Geometry("jME3 Branding", new Quad(1, 1));
jmeGeometry.setLocalTranslation((cam.getWidth() - 690.0f) * 0.5f, (cam.getHeight() - 303.0f) * 0.5f, 0);
jmeGeometry.setLocalScale(690, 303, 1);
jmeGeometry.setMaterial(assetManager.loadMaterial("Materials/Logo-jME3.j3m"));
guiNode.attachChild(jmeGeometry);
System.out.println("JMONKEY : " + jmeGeometry.getLocalTranslation());
LoadingScreen loadingScreen = new LoadingScreen();
stateManager.attach(loadingScreen);
MainScreen mainScreen = new MainScreen();
stateManager.attach(mainScreen);
GameScreen gameScreen = new GameScreen();
stateManager.attach(gameScreen);
new Thread(() -> {
enqueue(() -> {
NiftyJmeDisplay display = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
display.getNifty().fromXml("Interface/nifty-screens.xml", "jmonkey-splash", loadingScreen, mainScreen, gameScreen);
guiViewPort.addProcessor(display);
jmeGeometry.removeFromParent();
});
}).start();
}