@Override public boolean isTouched () { return input.isTouched(); }
@Override public boolean isTouched (int pointer) { return input.isTouched(pointer); }
private boolean isTouched (float startX, float endX) { // Check for touch inputs between startX and endX // startX/endX are given between 0 (left edge of the screen) and 1 (right edge of the screen) for (int i = 0; i < 2; i++) { float x = Gdx.input.getX(i) / (float)Gdx.graphics.getWidth(); if (Gdx.input.isTouched(i) && (x >= startX && x <= endX)) { return true; } } return false; }
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) { if (pointer != -1) return; if (Gdx.input.isTouched()) return; Actor actor = event.getListenerActor(); if (fromActor != null && fromActor.isDescendantOf(actor)) return; setContainerPosition(actor, x, y); manager.enter(this); }
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) { if (pointer != -1) return; if (Gdx.input.isTouched()) return; Actor actor = event.getListenerActor(); if (fromActor != null && fromActor.isDescendantOf(actor)) return; setContainerPosition(actor, x, y); manager.enter(this); }
public void render () { // set the clear color and clear the screen. Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (Gdx.input.isTouched()) { Gdx.graphics.setCursor(cursor1); } else { cursorActive = !cursorActive; if (cursorActive) { Gdx.graphics.setCursor(cursor2); } else { Gdx.graphics.setCursor(cursor3); } } } }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); renderer.setProjectionMatrix(camera.combined); if (Gdx.input.isTouched()) camera.unproject(globalCoords.set(Gdx.input.getX(), Gdx.input.getY(), 0)); solveFakeIK(globalCoords); renderBones(); }
public void render () { // set the clear color and clear the screen. Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // draw the sprite batch.begin(); batch.draw(texture, spritePosition.x, spritePosition.y); batch.end(); // if a finger is down, set the sprite's x/y coordinate. if (Gdx.input.isTouched()) { // the unproject method takes a Vector3 in window coordinates (origin in // upper left corner, y-axis pointing down) and transforms it to world // coordinates. camera.unproject(spritePosition.set(Gdx.input.getX(), Gdx.input.getY(), 0)); } } }
@Override public void render () { Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); renderer.setProjectionMatrix(camera.combined); renderer.begin(ShapeType.Filled); int size = Math.max(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()) / 10; for (int i = 0; i < 10; i++) { if (!Gdx.input.isTouched(i)) continue; viewport.unproject(tp.set(Gdx.input.getX(i), Gdx.input.getY(i))); Color color = colors[i % colors.length]; renderer.setColor(color); float sSize = size * Gdx.input.getPressure(i); renderer.triangle(tp.x, tp.y + sSize, tp.x + sSize, tp.y - sSize, tp.x - sSize, tp.y - sSize); } renderer.end(); }
gestureStartTime = Gdx.input.getCurrentEventTime(); tracker.start(x, y, gestureStartTime); if (Gdx.input.isTouched(1)) {
gestureStartTime = Gdx.input.getCurrentEventTime(); tracker.start(x, y, gestureStartTime); if (Gdx.input.isTouched(1)) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (Gdx.input.isTouched()) { stage.screenToStageCoordinates(stageCoords.set(Gdx.input.getX(), Gdx.input.getY())); Actor actor = stage.hit(stageCoords.x, stageCoords.y, true);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.begin(ShapeType.Filled); if (Gdx.input.isTouched()) renderer.setColor(Color.RED); else
@Override public void handleInput() { if(Gdx.input.isTouched()) { if(gameover) gsm.set(new PlayState(gsm)); else bird.jump(); } }
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) { if (pointer != -1) return; if (Gdx.input.isTouched()) return; Actor actor = event.getListenerActor(); if (fromActor != null && fromActor.isDescendantOf(actor)) return; setContainerPosition(actor, x, y); manager.enter(this); }
private void updateCamera() { direction.set(0.0f, 0.0f); int mouseX = Gdx.input.getX(); int mouseY = Gdx.input.getY(); int width = Gdx.graphics.getWidth(); int height = Gdx.graphics.getHeight(); if (Gdx.input.isKeyPressed(Keys.LEFT) || (Gdx.input.isTouched() && mouseX < width * 0.25f)) { direction.x = -1; } else if (Gdx.input.isKeyPressed(Keys.RIGHT) || (Gdx.input.isTouched() && mouseX > width * 0.75f)) { direction.x = 1; } if (Gdx.input.isKeyPressed(Keys.UP) || (Gdx.input.isTouched() && mouseY < height * 0.25f)) { direction.y = 1; } else if (Gdx.input.isKeyPressed(Keys.DOWN) || (Gdx.input.isTouched() && mouseY > height * 0.75f)) { direction.y = -1; } direction.nor().scl(CAMERA_SPEED * Gdx.graphics.getDeltaTime());; camera.position.x += direction.x; camera.position.y += direction.y; camera.update(); }
public void checkInput(OrthoCamera cam) { if (Gdx.input.isTouched()) { int button = getButtonPressed(); Vector2 pos = cam.unprojectCoordinates(Gdx.input.getX(), Gdx.input.getY()); for (MouseListener l : listeners) if(l.onMousePressed(cam, pos.x, pos.y, button)) break; } }
int height = Gdx.graphics.getHeight(); if (Gdx.input.isKeyPressed(Keys.LEFT) || (Gdx.input.isTouched() && mouseX < width * 0.25f)) { direction.x = -1; else if (Gdx.input.isKeyPressed(Keys.RIGHT) || (Gdx.input.isTouched() && mouseX > width * 0.75f)) { direction.x = 1; if (Gdx.input.isKeyPressed(Keys.UP) || (Gdx.input.isTouched() && mouseY < height * 0.25f)) { direction.y = 1; else if (Gdx.input.isKeyPressed(Keys.DOWN) || (Gdx.input.isTouched() && mouseY > height * 0.75f)) { direction.y = -1;
int height = Gdx.graphics.getHeight(); if (Gdx.input.isKeyPressed(Keys.LEFT) || (Gdx.input.isTouched() && mouseX < width * 0.25f)) { direction.x = -1; else if (Gdx.input.isKeyPressed(Keys.RIGHT) || (Gdx.input.isTouched() && mouseX > width * 0.75f)) { direction.x = 1; if (Gdx.input.isKeyPressed(Keys.UP) || (Gdx.input.isTouched() && mouseY < height * 0.25f)) { direction.y = 1; else if (Gdx.input.isKeyPressed(Keys.DOWN) || (Gdx.input.isTouched() && mouseY > height * 0.75f)) { direction.y = -1;
@Override public void update (float delta) { simulation.update(delta); float accelerometerY = Gdx.input.getAccelerometerY(); if (accelerometerY < 0) simulation.moveShipLeft(delta, Math.abs(accelerometerY) / 10); else simulation.moveShipRight(delta, Math.abs(accelerometerY) / 10); if (invaders.getController() != null) { if (buttonsPressed > 0) { simulation.shot(); } // if the left stick moved, move the ship float axisValue = invaders.getController().getAxis(Ouya.AXIS_LEFT_X) * 0.5f; if (Math.abs(axisValue) > 0.25f) { if (axisValue > 0) { simulation.moveShipRight(delta, axisValue); } else { simulation.moveShipLeft(delta, -axisValue); } } } if (Gdx.input.isKeyPressed(Keys.DPAD_LEFT) || Gdx.input.isKeyPressed(Keys.A)) simulation.moveShipLeft(delta, 0.5f); if (Gdx.input.isKeyPressed(Keys.DPAD_RIGHT) || Gdx.input.isKeyPressed(Keys.D)) simulation.moveShipRight(delta, 0.5f); if (Gdx.input.isTouched() || Gdx.input.isKeyPressed(Keys.SPACE)) simulation.shot(); }