Does anyone know how to make nifty support multipoint events?

Hi everyone.
I am doing demo of cs game on android, and I use nifty to create virtual buttons. However, I found that nifty only handles the first finger pressed event with PointerId of 0. Can anyone tell me where to modify nifty so that nifty handles all touch pointer events? I need to use multi-touch. Currently, I have no plans to change to lumer, so I hope someone can help, thank you.

I don’t believe Nifty supports multitouch.

I know you say you don’t want to switch to Lemur but I can say that Lemur DOES support multitouch and your UI is very simple. It’s probably a quick conversion and will be a lot less code in the end.

3 Likes

One reason why I don’t use lumer is that I am not good at writing gui in java. This is why I still use nifty. I saw in a post that someone said that nifty only consumes one touch event instead of traversing all touch events. If I didn’t find this code, I might really want to change to Lumer. thank you. :joy:

But you must use some kind of code to place the buttons around the screen on the targets and stuff.

Given that all of your buttons are just icons, the Lemur code is very simple:

Button b = new Button("");
b.setBackground(new ImageIcon("path to your icon image"));
b.addClickCommands(new Command<Button>() {
        public void execute( Button source ) {
            // Do the stuff for the button press
        }
    });
b.setLocalTranslation(position on screen);
guiNode.attachChild(b);

If your top buttons are in a layout, that’s straight forward also.

If you are actually interested, I could provide a more faithful adaptation of the nifty UI if I could see the code+XML+whatever.

Edit: re: code example, caveats for icon scaling, etc… might require one or two more lines than what was shown.

2 Likes

Okay, I will look into using lumer to improve my game.Thank you :slightly_smiling_face:
Another question is whether anyone is developing a tool to visualize lumer. It is still too difficult for a rookie to write GUI in pure java. :rofl:

1 Like

Ergh… yeah… kinda. I want to. I have plans to. I’m just one man, though. It more than likely won’t be this year.

1 Like

Looking forward to it, thank you to everyone who has contributed to the community!!! :+1: :+1:

2 Likes

Here’s the source code for NiftyGUI:

2 Likes