NiftyGUI Popup Example

I’ve been beating my head against NiftyGUI. Could someone point me to a simple working implementation of a popup using NiftyGUI (e.g., a simple confirmation dialog with a button that displays when a particular key is pressed)?

When I look at existing examples I get overwhelmed with their complexity (e.g. NiftyGuiDemo).

[java]
DialogBox dialog = new DialogBox(screen, “dlg”,
new Vector2f(
screen.getWidth()/2 - (screen.getStyle(“Window”).getVector2f(“defaultSize”).x/2),
screen.getHeight()/2 - (screen.getStyle(“Window”).getVector2f(“defaultSize”).y/2)
)
) {
@Override
public void onButtonOkPressed(MouseButtonEvent evt, boolean toggled) {
System.out.println(“Of course you do”);
}
};
dialog.setWindowTitle(“HEY YOU!”);
dialog.setMsg(“You want an easy to use GUI?”);
screen.addElement(dialog);
dialog.showWindow();
[/java]

Oh wait… that’s not Nifty… that’s the other one.

[xml]

[/xml]

[java] if (popupElement == null) {
popupElement = nifty.createPopup(“popupLoginProgress”);
HeroDexAudioState.getInstance().startEffect(HeroDexAudioState.DiscreteEffect.CONNECTING);
}
nifty.showPopup(nifty.getCurrentScreen(), popupElement.getId(), null);
[/java]

Damn forums still eating XML

@t0neg0d said: [java] DialogBox dialog = new DialogBox(screen, "dlg", new Vector2f( screen.getWidth()/2 - (screen.getStyle("Window").getVector2f("defaultSize").x/2), screen.getHeight()/2 - (screen.getStyle("Window").getVector2f("defaultSize").y/2) ) ) { @Override public void onButtonOkPressed(MouseButtonEvent evt, boolean toggled) { System.out.println("Of course you do"); } }; dialog.setWindowTitle("HEY YOU!"); dialog.setMsg("You want an easy to use GUI?"); screen.addElement(dialog); dialog.showWindow(); [/java]

Oh wait… that’s not Nifty… that’s the other one.

What a coincidence :smiley: