本文整理汇总了Java中de.lessvoid.nifty.Nifty类的典型用法代码示例。如果您正苦于以下问题:Java Nifty类的具体用法?Java Nifty怎么用?Java Nifty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Nifty类属于de.lessvoid.nifty包,在下文中一共展示了Nifty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NiftyJmeDisplay
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public NiftyJmeDisplay(AssetManager assetManager,
InputManager inputManager,
AudioRenderer audioRenderer,
ViewPort vp){
this.assetManager = assetManager;
w = vp.getCamera().getWidth();
h = vp.getCamera().getHeight();
resourceLocation = new ResourceLocationJme();
ResourceLoader.removeAllResourceLocations();
ResourceLoader.addResourceLocation(resourceLocation);
soundDev = new SoundDeviceJme(assetManager, audioRenderer);
renderDev = new RenderDeviceJme(this);
inputSys = new InputSystemJme(inputManager);
if (inputManager != null)
inputManager.addRawInputListener(inputSys);
nifty = new Nifty(renderDev, soundDev, inputSys, new TimeProvider());
inputSys.setNifty(nifty);
}
示例2: bind
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void bind(Nifty nifty, Screen screen) {
window = screen.findElementByName("wdDemo").getNiftyControl(Window.class);
rbHand[0] = screen.findElementByName("rbLeftHand").getNiftyControl(RadioButton.class);
rbHand[1] = screen.findElementByName("rbRightHand").getNiftyControl(RadioButton.class);
rbHand[2] = screen.findElementByName("rbBothHands").getNiftyControl(RadioButton.class);
rbHand[3] = screen.findElementByName("rbAnyHand").getNiftyControl(RadioButton.class);
lbGrasped = screen.findElementByName("lbGrasped").getNiftyControl(Label.class);
btRelease = screen.findElementByName("btRelease").getNiftyControl(Button.class);
btDestroy = screen.findElementByName("btDestroy").getNiftyControl(Button.class);
btPlaneRotL = screen.findElementByName("btPlaneRotL").getNiftyControl(Button.class);
btPlaneRotR = screen.findElementByName("btPlaneRotR").getNiftyControl(Button.class);
sbObjRot[0] = screen.findElementByName("sbObjRotX").getNiftyControl(Scrollbar.class);
sbObjRot[1] = screen.findElementByName("sbObjRotY").getNiftyControl(Scrollbar.class);
sbObjRot[2] = screen.findElementByName("sbObjRotZ").getNiftyControl(Scrollbar.class);
lbObjAngles[0] = screen.findElementByName("lbObjAngleX").getNiftyControl(Label.class);
lbObjAngles[1] = screen.findElementByName("lbObjAngleY").getNiftyControl(Label.class);
lbObjAngles[2] = screen.findElementByName("lbObjAngleZ").getNiftyControl(Label.class);
btRecStart = screen.findNiftyControl("btRecStart", Button.class);
btRecFinish = screen.findNiftyControl("btRecFinish", Button.class);
btRecUndo = screen.findNiftyControl("btRecUndo", Button.class);
nifty.subscribeAnnotations(this);
}
示例3: show
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void show(Nifty nifty, final String message) {
this.nifty = nifty;
ScreenBuilder builder;
if (Constants.android) {
builder = createAndroid(message);
} else {
builder = createDesktop(message);
}
Screen scr = builder.build(nifty);
textField = scr.findNiftyControl("textField", TextField.class);
nifty.addScreen(SCREEN_ID, scr);
nifty.gotoScreen(SCREEN_ID);
}
示例4: WindowAccount
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public WindowAccount(int id, Nifty nifty, GenericSendTask accountTask) throws JSONException {
this.id = id;
this.nifty = nifty;
this.scheduler = Executors.newScheduledThreadPool(1);
this.accountController = new AccountController();
this.accountController.addObserver(accountTask);
accountTask.addObserver(this.accountController);
this.animatorOverlay = new AnimatorOverlayData();
InputData inputData = new InputData("configInput.json");
this.accountOverlay = new AccountOverlay(inputData);
accountTask.addObserver(this.accountOverlay);
this.accountOverlay.addObserver(accountTask);
ConsoleWriter.debug("end constructor Interface");
}
示例5: WindowGame
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public WindowGame(int id, Nifty nifty, GenericSendTask inputTask, GenericSendTask gameTask) throws JSONException, SlickException {
this.id = id;
this.nifty = nifty;
InputData inputData = new InputData("configInput.json");
this.input = new InputGame(inputData);
this.input.addObserver(inputTask);
this.gameController = new GameController();
this.animatorGameData = new AnimatorGameData();
this.animatorOverlayData = new AnimatorOverlayData();
this.gameOverlay = new GameOverlay(inputData);
gameTask.addObserver(this.gameController);
this.gameController.addObserver(gameTask);
gameTask.addObserver(this.gameOverlay);
this.gameOverlay.addObserver(gameTask);
}
示例6: bind
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
super.bind(nifty, screen);
// login
tfEmail = (TextField) nifty.getScreen("start").
findNiftyControl("tfEmail", TextField.class);
tfPassword = (TextField) nifty.getScreen("start").
findNiftyControl("tfPassword", TextField.class);
lbCheck = (Label) nifty.getScreen("start").
findNiftyControl("lbCheck", Label.class);
// register
tfRegName = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegName", TextField.class);
tfRegEmail = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegEmail", TextField.class);
tfRegPassword = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegPassword", TextField.class);
tfRegPassword2 = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegPassword2", TextField.class);
lbRegCheck = (Label) nifty.getScreen("start").
findNiftyControl("lbRegCheck", Label.class);
}
示例7: 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);
}
示例8: 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);
}
}
示例9: activate
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
/**Called when activating the effect
* @param nifty - the main nifty calling class
* @param element - the element triggering the effect
* @param parameter - the parameters passed in for the effect
* **/
@Override
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
super.activate(nifty, element, parameter);
if (parameter.getProperty("startColor") != null) {
start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
}
if (parameter.getProperty("endColor") != null) {
end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
}
if (parameter.getProperty("start") != null) {
start = new Alpha(parameter.getProperty("start"));
}
if (parameter.getProperty("end") != null) {
end = new Alpha(parameter.getProperty("end"));
}
interpolator = parameter.getInterpolator();
}
示例10: bind
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
this.screen = screen;
turnText = screen.findElementById("turnText");
playerName = screen.findElementById("playerName");
moneyBar = screen.findNiftyControl("moneyBar", Loadingbar.class);
energyBar = screen.findNiftyControl("energyBar", Loadingbar.class);
populationBar = screen.findNiftyControl("populationBar", Loadingbar.class);
unitBox = screen.findElementById("unitBox");
addImages();
Globals.setHUDController(this);
}
示例11: createNewGui
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
/**
* Create a new empty gui with one screen and set as the current gui.
* @param nifty a valid Nifty instace @see Nifty
* @throws ParserConfigurationException if controller failed to create
* a valid document instance
*/
public void createNewGui(Nifty nifty) throws ParserConfigurationException, JAXBException, ClassNotFoundException, IOException, NoProductException{
gui= GUIFactory.getInstance().createGUI(nifty);
GScreen screen = (GScreen) GUIFactory.getInstance().newGElement(GScreen.class);
GLayer layer1 = (GLayer) GUIFactory.getInstance().newGElement(GLayer.class);
screen.addChild(layer1, true);
getGui().addScreen(screen);
this.currentS = screen;
this.currentL = layer1;
this.currentlayers.clear();
this.currentlayers.add(layer1);
GUseControls standardControls = new GUseControls();
GUseStyle standardStyle = new GUseStyle();
standardControls.setFilename("nifty-default-controls.xml");
standardStyle.setFilename("nifty-default-styles.xml");
this.gui.addUseControls(standardControls);
this.gui.addUseStyles(standardStyle);
this.model.setCurentGUI(gui);
this.setChanged();
this.notifyObservers(new ReloadGuiEvent(gui));
this.clearChanged();
writer = new GUIWriter(gui);
dragDropManager = new NiftyDDManager(nifty);
System.gc();
}
示例12: refresh
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void refresh() {
Nifty temp = nElement.getNifty();
Attributes att = this.nElement.getElementType().getAttributes();
String newStyle = att.get("style");
Attributes attcopy = new Attributes(att);
// Add the old style if there was one
if (oldStyle != null && !oldStyle.equals(newStyle)) {
att.set("style", oldStyle);
nElement.setStyle(newStyle);
attcopy = att;
oldStyle = newStyle;
}
if (att.isSet("renderOrder")) {
int renderorder = att.get("renderOrder").isEmpty() ? this.parent.children.indexOf(this) : att.getAsInteger("renderOrder");
nElement.setRenderOrder(renderorder);
}
nElement.setId(id);
this.internalRefresh(temp, attcopy);
this.processRemoved();
fireUpdate();
}
示例13: activate
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
/**Called when activating the effect
* @param nifty - the main nifty calling class
* @param element - the element triggering the effect
* @param parameter - the parameters passed in for the effect
* **/
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
this.el = element;
if (parameter.getProperty("startColor") != null) {
start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
}
if (parameter.getProperty("endColor") != null) {
end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
}
if (parameter.getProperty("start") != null) {
start = new Alpha(parameter.getProperty("start"));
}
if (parameter.getProperty("end") != null) {
end = new Alpha(parameter.getProperty("end"));
}
interpolator = parameter.getInterpolator();
}
示例14: 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();
}
示例15: setNifty
import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
void setNifty(final Nifty nifty) {
this.nifty = nifty;
if (Globals.replayMode) {
return;
}
DeathMatchHeroSelectionLayerBuilder layerBuilder
= new DeathMatchHeroSelectionLayerBuilder();
Screen screen = nifty.getScreen("default_hud");
heroSelectionLayer = layerBuilder
.build(nifty, screen, screen.getRootElement());
heroSelectionLayer.hideWithoutEffect();
DeathMatchHeroSelectionLayerController control = heroSelectionLayer
.getControl(DeathMatchHeroSelectionLayerController.class);
control.setStateManager(states);
}