com.badlogic.gdx.Input.getY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中com.badlogic.gdx.Input.getY()方法的一些代码示例,展示了Input.getY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.getY()方法的具体详情如下:
包路径:com.badlogic.gdx.Input
类名称:Input
方法名:getY

Input.getY介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public int getY (int pointer) {
  return input.getY(pointer);
}

代码示例来源:origin: libgdx/libgdx

@Override
public int getY () {
  return input.getY();
}

代码示例来源:origin: libgdx/libgdx

@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();
}

代码示例来源:origin: libgdx/libgdx

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));
    }
  }
}

代码示例来源:origin: libgdx/libgdx

void triangulate () {
  // seed = 4139368480425561099l;
  // seed = 6559652580366669361l;
  MathUtils.random.setSeed(seed);
  int pointCount = 100;
  points.clear();
  for (int i = 0; i < pointCount; i++) {
    float value;
    do {
      value = MathUtils.random(10, 400);
    } while (points.contains(value));
    points.add(value);
    do {
      value = MathUtils.random(10, 400);
    } while (points.contains(value));
    points.add(value);
  }
  points.add(Gdx.input.getX());
  points.add(Gdx.graphics.getHeight() - Gdx.input.getY());
  triangles = trianglulator.computeTriangles(points, false);
}

代码示例来源:origin: libgdx/libgdx

@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();
}

代码示例来源:origin: libgdx/libgdx

stage.screenToStageCoordinates(stageCoords.set(Gdx.input.getX(), Gdx.input.getY()));
Actor actor = stage.hit(stageCoords.x, stageCoords.y, true);
if (actor != null)

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  // clear the screen, update the camera and make the sprite batch
  // use its matrices.
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  batch.setProjectionMatrix(camera.combined);
  // render all the things, we render in a y-down
  // cartesian coordinate system
  batch.begin();
  // drawing a region, x and y will be the top left corner of the region, would be bottom left
  // with y-up.
  batch.draw(region, 20, 100);
  // drawing text, x and y will be the top left corner for text, same as with y-up
  font.draw(batch, "This is a test", 270, 100);
  // drawing regions from an atlas, x and y will be the top left corner.
  // you shouldn't call findRegion every frame, cache the result.
  batch.draw(atlas.findRegion("badlogicsmall"), 360, 100);
  // drawing a sprite created from an atlas, FIXME wut?! AtlasSprite#setPosition seems to be wrong
  sprite.setColor(Color.RED);
  sprite.draw(batch);
  // finally we draw our current touch/mouse coordinates
  font.draw(batch, Gdx.input.getX() + ", " + Gdx.input.getY(), 0, 0);
  batch.end();
  // tell the stage to act and draw itself
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
}

代码示例来源:origin: libgdx/libgdx

screenToStageCoordinates(tempCoords.set(Gdx.input.getX(), Gdx.input.getY()));
Actor actor = hit(tempCoords.x, tempCoords.y, true);
if (actor == null) return;

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  currentPosition = music.getPosition();
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  batch.draw(buttons, 0, 0);
  font.draw(batch, (int)currentPosition / 60 + ":" + (int)currentPosition % 60, 365, 35);
  batch.end();
  sliderUpdating = true;
  slider.setValue((currentPosition / songDuration) * 100f);
  sliderUpdating = false;
  stage.act();
  stage.draw();
  if (Gdx.input.justTouched()) {
    if (Gdx.input.getY() > Gdx.graphics.getHeight() - 64) {
      if (Gdx.input.getX() < 64) {
        music.play();
      }
      if (Gdx.input.getX() > 64 && Gdx.input.getX() < 128) {
        music.stop();
      }
      if (Gdx.input.getX() > 128 && Gdx.input.getX() < 192) {
        music.pause();
      }
    }
  }
}

代码示例来源:origin: libgdx/libgdx

screenToStageCoordinates(tempCoords.set(Gdx.input.getX(), Gdx.input.getY()));
Actor actor = hit(tempCoords.x, tempCoords.y, true);
if (actor == null) return;

代码示例来源:origin: libgdx/libgdx

else
  renderer.setColor(Color.GREEN);
renderer.rect(Gdx.input.getX() - 15, Gdx.graphics.getHeight() - Gdx.input.getY() - 15, 30, 30);
renderer.rect(x, y, 30, 30);
renderer.end();

代码示例来源:origin: libgdx/libgdx

vert.setHeight(Gdx.graphics.getHeight() - Gdx.input.getY() - vert.getY());
vertWrap.setHeight(Gdx.graphics.getHeight() - Gdx.input.getY() - vertWrap.getY());

代码示例来源:origin: libgdx/libgdx

batch.draw(tex, Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY());
font.draw(batch, "" + Gdx.graphics.getWidth() + ", " + Gdx.graphics.getHeight(), 0, 20);
batch.end();

代码示例来源:origin: com.github.nifty-gui/nifty-libgdx-renderer

@Override
 public boolean scrolled(final int amount) {
  eventQueue.offer(GdxMouseInputEvent.getMouseEvent(input.getX(), input.getY(), amount, 0,
    GdxMouseInputEvent.NO_BUTTON, false, false));
  return true;
 }
}

代码示例来源:origin: nifty-gui/nifty-gui

@Override
 public boolean scrolled(final int amount) {
  eventQueue.offer(GdxMouseInputEvent.getMouseEvent(input.getX(), input.getY(), amount, 0,
    GdxMouseInputEvent.NO_BUTTON, false, false));
  return true;
 }
}

代码示例来源:origin: jmrapp1/SpaceInvaders

@Override
public boolean tap(float arg0, float arg1, int arg2, int button) {
  for (MouseListener l : listeners)
    if(l.onMouseClicked(Gdx.input.getX(), Gdx.input.getY(), button))
      break;
  return false;
}

代码示例来源:origin: narfman0/GDXWorld

/** @param stage the Stage which coordinate system should be used
 *  @param pointer the pointer which position to return
 *  @return the position of the given pointer in stage coordinates */
public static Vector2 pointerPosition(Stage stage, int pointer) {
  tmp.set(Gdx.input.getX(pointer), Gdx.input.getY(pointer));
  stage.screenToStageCoordinates(tmp);
  return tmp;
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-components-libgdx

@Override
  protected void process(Entity e) {

    final Pos pos = pm.get(e);

    aimAtTmp.set(Gdx.input.getX(), Gdx.input.getY(), 0);

    final Vector3 unproject = cameraSystem.camera.unproject(aimAtTmp);

    pos.x = unproject.x;
    pos.y = unproject.y;
  }
}

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

@Override
public void layout() {
  updateLinesFromModel();
  // Manually update hover state
  {
    int screenX = Gdx.input.getX();
    int screenY = Gdx.input.getY();
    Vector2 localCoord = screenToLocalCoordinates(tmpVec2.set(screenX, screenY));
    updateLinesHover(localCoord.x, localCoord.y);
  }
}

相关文章