Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.1156368
- -0.13125038
- -1.0500145
- 0.98439217
- -1.0500202
- 0.91877174
- -0.984396
- 0.9187679
- -0.98439026
- 0.9187641
- -0.13125038
- public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
- cam.translate(-deltaX, -deltaY);
- cam.translate(-deltaX / 2, -deltaY / 2);
- public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
- camera.position.add((-x), (y), 0);
- camera.update();
- }
- private Vector3 prevDragPos;
- addListener(new InputListener(){
- @Override
- public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
- return true;
- }
- @Override
- public void touchDragged(InputEvent event, float x, float y, int pointer) {
- x = Gdx.input.getX(pointer);
- y = Gdx.input.getY(pointer);
- if(prevDragPos == null) prevDragPos = new Vector3(x, y, 0);
- float scale = ((MapStage) getStage()).getScale();
- getStage().getCamera().position.add((prevDragPos.x - x)/scale, (y - prevDragPos.y)/scale, 0);
- System.out.println((prevDragPos.x - x)/scale + ", " + (y - prevDragPos.y)/scale);
- prevDragPos.set(x, y, 0);
- }
- @Override
- public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
- prevDragPos = null ;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement