use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestAppStates method initialize.
@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);
}
use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestNiftyExamples method simpleInitApp.
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);
}
use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestCinematic method simpleInitApp.
@Override
public void simpleInitApp() {
//just some text
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(getAssetManager(), getInputManager(), getAudioRenderer(), getGuiViewPort());
Nifty nifty;
nifty = niftyDisplay.getNifty();
nifty.fromXmlWithoutStartScreen("Interface/Nifty/CinematicTest.xml");
getGuiViewPort().addProcessor(niftyDisplay);
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
final BitmapText text = new BitmapText(guiFont, false);
text.setSize(guiFont.getCharSet().getRenderedSize());
text.setText("Press enter to play/pause cinematic");
text.setLocalTranslation((cam.getWidth() - text.getLineWidth()) / 2, cam.getHeight(), 0);
guiNode.attachChild(text);
createScene();
cinematic = new Cinematic(rootNode, 20);
stateManager.attach(cinematic);
createCameraMotion();
//creating spatial animation for the teapot
AnimationFactory factory = new AnimationFactory(20, "teapotAnim");
factory.addTimeTranslation(0, new Vector3f(10, 0, 10));
factory.addTimeTranslation(20, new Vector3f(10, 0, -10));
factory.addTimeScale(10, new Vector3f(4, 4, 4));
factory.addTimeScale(20, new Vector3f(1, 1, 1));
factory.addTimeRotationAngles(20, 0, 4 * FastMath.TWO_PI, 0);
AnimControl control = new AnimControl();
control.addAnim(factory.buildAnimation());
teapot.addControl(control);
//fade in
cinematic.addCinematicEvent(0, new FadeEvent(true));
// cinematic.activateCamera(0, "aroundCam");
cinematic.addCinematicEvent(0, new AnimationEvent(teapot, "teapotAnim", LoopMode.DontLoop));
cinematic.addCinematicEvent(0, cameraMotionEvent);
cinematic.addCinematicEvent(0, new SoundEvent("Sound/Environment/Nature.ogg", LoopMode.Loop));
cinematic.addCinematicEvent(3f, new SoundEvent("Sound/Effects/kick.wav"));
cinematic.addCinematicEvent(3, new SubtitleTrack(nifty, "start", 3, "jMonkey engine really kicks A..."));
cinematic.addCinematicEvent(5.1f, new SoundEvent("Sound/Effects/Beep.ogg", 1));
cinematic.addCinematicEvent(2, new AnimationEvent(model, "Walk", LoopMode.Loop));
cinematic.activateCamera(0, "topView");
// cinematic.activateCamera(10, "aroundCam");
//fade out
cinematic.addCinematicEvent(19, new FadeEvent(false));
// cinematic.addCinematicEvent(19, new AbstractCinematicEvent() {
//
// @Override
// public void onPlay() {
// fade.setDuration(1f / cinematic.getSpeed());
// fade.fadeOut();
//
// }
//
// @Override
// public void onUpdate(float tpf) {
// }
//
// @Override
// public void onStop() {
// }
//
// @Override
// public void onPause() {
// }
// });
cinematic.addListener(new CinematicEventListener() {
public void onPlay(CinematicEvent cinematic) {
chaseCam.setEnabled(false);
System.out.println("play");
}
public void onPause(CinematicEvent cinematic) {
System.out.println("pause");
}
public void onStop(CinematicEvent cinematic) {
chaseCam.setEnabled(true);
fade.setValue(1);
System.out.println("stop");
}
});
//cinematic.setSpeed(2);
flyCam.setEnabled(false);
chaseCam = new ChaseCamera(cam, model, inputManager);
initInputs();
}
use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestContextSwitching method simpleInitApp.
@Override
public void simpleInitApp() {
clContext = null;
NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml("jme3test/opencl/ContextSwitchingScreen.xml", "Screen", this);
guiViewPort.addProcessor(niftyDisplay);
inputManager.setCursorVisible(true);
flyCam.setEnabled(false);
}
use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestNiftyGui method simpleInitApp.
@Override
public void simpleInitApp() {
Box b = new Box(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 = NiftyJmeDisplay.newNiftyJmeDisplay(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);
}
Aggregations