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

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

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

Input.justTouched介绍

暂无

代码示例

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

@Override
public boolean justTouched () {
  return input.justTouched();
}

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

@Override
public void render () {
  if (Gdx.input.justTouched()) Gdx.app.exit();
}

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

@Override
  public void render () {
    if (Gdx.input.justTouched()) {
      expectIt = true;
      Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
          throw new RuntimeException("This is a test of the uncaught exception handler.");
        }
      });
    }
  }
}

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

public void render () {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    font.draw(batch, message, 10, 40);
    batch.end();

    if (Gdx.input.justTouched()) {
      
    }
  }
}

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

@Override
  public void render () {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    font.draw(batch, "Touch screen to vibrate", 100, 100);
    batch.end();

    if (Gdx.input.justTouched()) Gdx.input.vibrate(100);
  }
}

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

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  font.draw(batch, "input: " + text, 0, Gdx.graphics.getHeight());
  batch.end();
  if (Gdx.input.justTouched()) Gdx.input.setOnscreenKeyboardVisible(true);
}

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  font.draw(batch, textBuffer, 0, Gdx.graphics.getHeight() - 20);
  batch.end();
  // bring up the keyboard if we touch the screen
  if (Gdx.input.justTouched()) {
    Gdx.input.setOnscreenKeyboardVisible(true);
    textBuffer = new SimpleCharSequence();
  }
}

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

public void render () {
    if (Gdx.input.justTouched()) {
      for (int i = 0; i < 10; i++) {
        if (font != null) {
          font.dispose();
        }
        FileHandle fontFile = Gdx.files.internal("data/arial.ttf");
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

        FreeTypeFontParameter parameter = new FreeTypeFontParameter();
        parameter.size = 15;

        font = generator.generateFont(parameter);
        generator.dispose();
      }
      for (int i = 0; i < 10; i++)
        System.gc();
      Gdx.app.log("FreeTypeDisposeTest", "generated 10 fonts");
      Gdx.app.log("FreeTypeDisposeTest", Gdx.app.getJavaHeap() + ", " + Gdx.app.getNativeHeap());
    }
  }
}

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  if (manager.update() && manager.isLoaded("size10.ttf")) {
    batch.begin();
    manager.get("size10.ttf", BitmapFont.class).draw(batch, "First font!", 20, 20);
    manager.get("size20.ttf", BitmapFont.class).draw(batch, "Second font!", 20, 50);
    manager.get("data/default.fnt", BitmapFont.class).draw(batch, "Default font!", 20, 100);
    batch.end();
  }
  if (Gdx.input.justTouched() && manager.isLoaded("size10.ttf")) {
    // unload all the things and check if they really get disposed properly
    manager.unload("size10.ttf");
    manager.finishLoading();
    if (manager.isLoaded("size10.ttf")) throw new RuntimeException("broken");
    if (!manager.isLoaded("size20.ttf")) throw new RuntimeException("broken");
    manager.unload("size20.ttf");
    manager.finishLoading();
    if (manager.isLoaded("size10.ttf")) throw new RuntimeException("broken");
    if (manager.isLoaded("size20.ttf")) throw new RuntimeException("broken");
  }
}

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

@Override
  public void render () {
    if (Gdx.input.justTouched()) {
      Gdx.app.log("Input Test", "just touched, button: " + (Gdx.input.isButtonPressed(Buttons.LEFT) ? "left " : "")
        + (Gdx.input.isButtonPressed(Buttons.MIDDLE) ? "middle " : "")
        + (Gdx.input.isButtonPressed(Buttons.RIGHT) ? "right" : "")
        + (Gdx.input.isButtonPressed(Buttons.BACK) ? "back" : "")
        + (Gdx.input.isButtonPressed(Buttons.FORWARD) ? "forward" : ""));
    }

    for (int i = 0; i < 10; i++) {
      if (Gdx.input.getDeltaX(i) != 0 || Gdx.input.getDeltaY(i) != 0) {
        Gdx.app.log("Input Test", "delta[" + i + "]: " + Gdx.input.getDeltaX(i) + ", " + Gdx.input.getDeltaY(i));
      }
    }
// Gdx.input.setCursorPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
// if(Gdx.input.isTouched()) {
// Gdx.app.log("Input Test", "is touched");
// }
  }

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

@Override
public void render () {
  Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
  Gdx.gl.glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
  cam.update();
  modelInstance.transform.rotate(Vector3.Y, 45 * Gdx.graphics.getDeltaTime());
  modelBatch.begin(cam);
  modelBatch.render(modelInstance);
  modelBatch.end();
  if (Gdx.input.justTouched() || fbTexture == null) {
    if (fbTexture != null) fbTexture.getTexture().dispose();
    fbTexture = ScreenUtils.getFrameBufferTexture();
  }
  batch.begin();
  if (fbTexture != null) {
    batch.draw(fbTexture, 0, 0, 100, 100);
  }
  font.draw(batch, "Touch screen to take a snapshot", 10, 40);
  batch.end();
}

代码示例来源: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

batch.end();
if (Gdx.input.justTouched()) {
  useStage = !useStage;

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

batch.end();
if (Gdx.input.justTouched()) {
  if (fullscreen) {
    Gdx.graphics.setWindowedMode(480, 320);

代码示例来源:origin: kotcrab/vis-ui

@Override
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
  if (!button.isDisabled() && activeTab != tab && Gdx.input.justTouched() == false && pointer == -1) {
    setCloseButtonOnMouseMove();
  }
}

代码示例来源:origin: BrentAureli/FlappyDemo

@Override
public void handleInput() {
  if(Gdx.input.justTouched()){
    gsm.set(new PlayState(gsm));
  }
}

代码示例来源:origin: BrentAureli/FlappyDemo

@Override
public void handleInput() {
  if(Gdx.input.justTouched()){
    gsm.set(new PlayState(gsm));
  }
}

代码示例来源:origin: dsaltares/ashley-superjumper

private void updateLevelEnd () {
  if (Gdx.input.justTouched()) {
    engine.removeAllEntities();
    world = new World(engine);
    world.score = lastScore;
    state = GAME_READY;
  }
}

代码示例来源:origin: BrentAureli/SuperMario

@Override
public void render(float delta) {
  if(Gdx.input.justTouched()) {
    game.setScreen(new PlayScreen((MarioBros) game));
    dispose();
  }
  Gdx.gl.glClearColor(0, 0, 0, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
}

代码示例来源:origin: dsaltares/ashley-superjumper

public void update () {
  if (Gdx.input.justTouched()) {
    guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
    if (nextBounds.contains(touchPoint.x, touchPoint.y)) {
      Assets.playSound(Assets.clickSound);
      game.setScreen(new HelpScreen5(game));
    }
  }
}

相关文章