I
I
Ilya Alekseev2016-07-05 20:34:50
Java
Ilya Alekseev, 2016-07-05 20:34:50

How to catch touchup event after double click?

I need to add a Listener to the stage so that after double-clicking when we release the button, the method will work.
Now the code is like this:

stage.addListener(new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                if( getTapCount() == 2)
                {
                    circle.accelerate();
                    dbClick = true;
                    return;
                }
            };

            @Override
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                return true;
            }

            @Override
            public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                if(dbClick)
                    circle.accelerate = -40;
            }
        });

after a double click, even clicked does not work, after adding touchdown and touchup. If just clicked then it works, but I need to catch the event when we release the button after it. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
exenza, 2016-07-13
@ilyaalekseev

Look at GestureDetector , in particular, the tap method handles multi-touch; wiki

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question