Nifty still processes mouse Events after removing it (2 posts)

  • Profile picture of vermillion vermillion said 3 months, 2 weeks ago:

    Hi,

    I just created a Menu for my project with nifty. When i hit de start button it removes nifty and loads the game resources. Everything fine but nifty somehow still catches my left mouse clicks… Everything else (like WASD for running or space for jumping goes through to my game logic).

    What am i doing wrong?

    Creating the Nifty GUI

    niftyDisplay = new NiftyJmeDisplay(assetManager,
                    inputManager,
                    audioRenderer,
                    guiViewPort);
            nifty = niftyDisplay.getNifty();
            //nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this);
            nifty.fromXml("Interface/MainMenu.xml", "start", this);
    
            // attach the nifty display to the gui view port as a processor
            this.guiViewPort.addProcessor(niftyDisplay);

    Getting the click and unloading the NiftyDisplay

    public void start(int x, int y) {
            this.inputManager.setCursorVisible(false);
            if (guiViewPort.getProcessors().contains(niftyDisplay)) {
                guiViewPort.removeProcessor(niftyDisplay);
            }
            this.gameStarted = true;
        }

    And that’s what it says when i click the left mouse button:

    05.02.2012 17:10:53 de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent
    INFO: [processMouseEvent] [501, 95, 0, 0, false] processed [true]

    If you need another code snippet let me know…

  • Profile picture of vermillion vermillion said 3 months, 2 weeks ago:

    Okay a simple

    nifty.exit(); 

    Did it…

    Sorry for bothering