private void initNifty() { flyCam.setDragToRotate(true); loginController = new LoginController(); loginController.initialize(app.getStateManager(), app); nifty.registerScreenController(loginController); loginScreenBuilder.buildLoginScreen(nifty, loginController); nifty .getScreen("LoginScreen") .findNiftyControl("PasswordTextField", TextField.class) .enablePasswordChar('*'); }
@Override public void initialize() { super.initialize(); // Several things rely on having this guiFont = loadGuiFont(); guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); viewPort.attachScene(rootNode); guiViewPort.attachScene(guiNode); if (inputManager != null) { // We have to special-case the FlyCamAppState because too // many SimpleApplication subclasses expect it to exist in // simpleInit(). But at least it only gets initialized if // the app state is added. if (stateManager.getState(FlyCamAppState.class) != null) { flyCam = new FlyByCamera(cam); flyCam.setMoveSpeed(1f); // odd to set this here but it did it before stateManager.getState(FlyCamAppState.class).setCamera(flyCam); } if (context.getType() == Type.Display) { inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE)); } if (stateManager.getState(StatsAppState.class) != null) { inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5)); inputManager.addListener(actionListener, INPUT_MAPPING_HIDE_STATS); } inputManager.addListener(actionListener, INPUT_MAPPING_EXIT); } if (stateManager.getState(StatsAppState.class) != null) { // Some of the tests rely on having access to fpsText // for quick display. Maybe a different way would be better. stateManager.getState(StatsAppState.class).setFont(guiFont); fpsText = stateManager.getState(StatsAppState.class).getFpsText(); } // call user code simpleInitApp(); }