Question

So i want to get two touches from one rectangle. So what i am doing is this

    Rectangle reset = new Rectangle(120, 40, 300, 100, act.getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,float pTouchAreaLocalX, float pTouchAreaLocalY) {


            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };

So this allows me to touch it. Dont worry i have registered all handlers and all that stuff. The thing i want to do is to touch one area and then touch another area and then draw a rectangle between the two touches. I am not quite sure how to capture the 2 separate touches. if any help is given i will be very thankful .

Was it helpful?

Solution

@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
    float pTouchAreaLocalX, float pTouchAreaLocalY) {
                if (pSceneTouchEvent.isActionDown()) {
                      // start X,Y
                }
                if (pSceneTouchEvent.isActionMove()) {
                      //what to do on move
                }
        if (pSceneTouchEvent.isActionUp()) {
                      // end X,Y
        }
    return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX,              pTouchAreaLocalY);

}

maybe this is, what you search?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top