本文整理汇总了Java中de.lessvoid.nifty.Nifty.fromXml方法的典型用法代码示例。如果您正苦于以下问题:Java Nifty.fromXml方法的具体用法?Java Nifty.fromXml怎么用?Java Nifty.fromXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.lessvoid.nifty.Nifty
的用法示例。
在下文中一共展示了Nifty.fromXml方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import de.lessvoid.nifty.Nifty; //导入方法依赖的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);
}
示例2: checkCompletion
import de.lessvoid.nifty.Nifty; //导入方法依赖的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);
}
}
示例3: init
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public void init() {
InputSystemAwtImpl inputSystem = new InputSystemAwtImpl();
FontProviderJava2dImpl fontProvider = new FontProviderJava2dImpl();
registerFonts(fontProvider);
RenderDeviceJava2dImpl renderDevice = new RenderDeviceJava2dImpl(graphWrap);
renderDevice.setFontProvider(fontProvider);
nifty = new Nifty(renderDevice, new SoudDevicenull(), inputSystem,new TimeProvider());
java.net.URL empty = getClass().getResource("/jada/ngeditor/resources/empty.xml");
try {
nifty.fromXml(empty.getFile(),empty.openStream(), "screen1");
} catch (IOException ex) {
Logger.getLogger(J2DNiftyView.class.getName()).log(Level.SEVERE, null, ex);
}
this.dragDropManager = new NiftyDDManager(nifty);
timer = new Timer(30,this);
timer.start();
this.setIgnoreRepaint(true);
nifty.resolutionChanged();
}
示例4: initGui
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
private void initGui() {
guiController = new GuiController();
NiftyJmeDisplay niftyDisplay= new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
Nifty nifty = niftyDisplay.getNifty();
String viewFname = "Interface/guiview.xml";
try {
nifty.validateXml(viewFname);
} catch (Exception ex) {
logger.log(Level.SEVERE, viewFname + " not valid", ex);
}
nifty.fromXml(viewFname, "guiView", guiController);
stateManager.attach(guiController);
// nifty.setDebugOptionPanelColors(true);
guiViewPort.addProcessor(niftyDisplay);
}
示例5: simpleInitApp
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
System.out.println("Main.simpleInitApp() is being called here.");
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
/** Create a new NiftyGUI object */
Nifty nifty = niftyDisplay.getNifty();
// How do I set the screen here?
/** Read your XML and initialize your custom ScreenController */
MainScreenController screenController = new MainScreenController(this);
stateManager.attach(screenController);
// [...] boilerplate init nifty omitted
nifty.fromXml("Interface/startGameScreen.xml", "startGameScreen", screenController);
nifty.addXml("Interface/hudScreen.xml");
//nifty.fromXml("Interface/hudScreen.xml", "hudScreen", screenController);
// attach the Nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
this._nifty = nifty;
System.out.println("In the Main.simpleInitApp() method, nifty is: " + nifty.toString());
// Q: How do I determine if "startGame" is the correct string to pass the above method?
// A: I think this (second parameter) is the ID of the screen in the given file.
//
// nifty.fromXml("Interface/startGameScreen.xml", "startGame"); // Once I have a screencontroller, we will use the commented version
// nifty.fromXml("Interface/helloworld.xml", "start", new MySettingsScreenController(data));
flyCam.setDragToRotate(true); // This may cause complications without additional on/off logic.
// if we have additional screens to load, just call them like this:
// nifty.fromXml("Interface/startGameScreen.xml", "startGame");
// We need to call LoadGameFromScreen() next!! If it won't be called from a screen,
// then it needs to be called here instead!
// Need to disable mouse cursor when ready to start actual game: mouseInput.setCursorVisible(false);
LoadGameFromScreen();
if (settings.getRenderer().startsWith("LWJGL")) {
BasicShadowRenderer bsr = new BasicShadowRenderer(assetManager, 512);
bsr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
viewPort.addProcessor(bsr);
}
}
示例6: bombFound
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public void bombFound() {
// final Explosion exp = new Explosion(assetManager);
//
// attachChild(exp);
//
// new Thread(new Runnable() {
//
// public void run() {
//
// int time = 50;
//
// exp.explode(10000);
//// for(int i = 0; i < 8; i++){
//// exp.explode(time);
//// try {
//// Thread.sleep(50);
//// time += 50;
//// } catch (InterruptedException ex) {
//// Logger.getLogger(SealField.class.getName()).log(Level.SEVERE, null, ex);
//// }
//// }
//
// }
// }).start();
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/gameOver.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);
}