开发者

How to implements touch listerner continuous like keyReapted (Andengine)

开发者 https://www.devze.com 2023-03-23 18:34 出处:网络
I implements IOnSceneTouchListener and override method in class and i implements in scene scene.setTouchAreaBindingEnabled(true);

I implements IOnSceneTouchListener and override method in class and i implements in scene

  scene.setTouchAreaBindingEnabled(true);

  scene.setOnSceneTouchListener(this);          

public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

Log.v("TouchEvent X",""+pSceneTouchEvent.getX());
L开发者_运维技巧og.v("TouchEvent Y",""+pSceneTouchEvent.getY());

return true;
}

and i able to get x any y position for every touch. How i get x and y postion for continuous touch


If by continuous you mean dragging/sliding over the screen, then you need to implement GestureListener. And measure initial .getX(), getY() and final getX(),getY()coordinates, since it allows you two MotionEvents.

0

精彩评论

暂无评论...
验证码 换一张
取 消