private void _touchButton() { Long time = System.currentTimeMillis(); if (time - lastClickTime > 200) { lastClickTime = time; touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0); touchPos = viewport.unproject(touchPos); dragonWarsEngine.touch(touchPos.x, touchPos.y); } }
/** * Transforms the screen coordinates to stage coordinates. * * @param screenCoords Input screen coordinates and output for resulting stage coordinates. */ public Vector2 screenToStageCoordinates(Vector2 screenCoords) { viewport.unproject(screenCoords); return screenCoords; }