我有个大问题。我已经试着找了几个小时了。但它并没有起作用。我的代码是:
@Override
public boolean onTouchEvent(MotionEvent event)
{
if (event. getAction ()==MotionEvent.ACTION_DOWN){
touchx = event . getX ();
touchy= event . getY();
}
}
return true;
}
@Override
public void render()
{
touch=Gdx.input.isTouched();
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
if(touchx>2){
batch.draw(texture, Gdx.graphics.getWidth() / 4, 0,
Gdx.graphics.getWidth() / 2, Gdx.graphics.getWidth() / 2);
}
batch.end();
}
它不起作用。问题出在哪里?
发布于 2014-07-15 16:13:36
@Override
public boolean dispatchTouchEvent(MotionEvent event){
int i=0;
i++;
System.out.println("-.-------------------X:"+event.getX()+"Y: "+event.getY());
return true;
}
https://stackoverflow.com/questions/23878886
复制相似问题