2

As the title says, is there a method in libGDX which returns the touch pressure (similar to MotionEvent.getPressure() in Android) ?

Or is there any other way I can get touch pressure in my game which works on both android and iOS(using RoboVM)?

2
  • I don't think this is supported yet in libgdx. And I don't think iOS devices have this feature yet.
    – Tenfour04
    Aug 12, 2015 at 12:08
  • 2
    You will probably have to go with (android) platform specific code here.
    – noone
    Aug 12, 2015 at 16:33

1 Answer 1

0

I can't help you with the iOS part but for android there is a work around

you can do something like this to get the pressure

View view = initializeForView(game, config);
view.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        getInput().onTouch(v, event);
        game.setPressure(event.getPressure());
        Log.v("log", "hooked " + event.getPressure());
        return true;
    }
});

and still have the complete event handling of libgdx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.