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

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

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

Input.setCursorCatched介绍

[英]Only viable on the desktop. Will confine the mouse cursor location to the window and hide the mouse cursor. X and y coordinates are still reported as if the mouse was not catched.
[中]只有在桌面上才可行。将鼠标光标位置限制在窗口中并隐藏鼠标光标。X和y坐标仍然报告为未捕获鼠标。

代码示例

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

@Override
public void setCursorCatched (boolean catched) {
  input.setCursorCatched(catched);
}

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

@Override
public boolean keyDown (int keycode) {
  Gdx.app.log("Input Test", "key down: " + keycode);
  if (keycode == Keys.G) Gdx.input.setCursorCatched(!Gdx.input.isCursorCatched());
  return false;
}

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

@Override
  public void run () {
    graphics.setVSync(graphics.config.vSyncEnabled);
    try {
      LwjglApplication.this.mainLoop();
    } catch (Throwable t) {
      if (audio != null) audio.dispose();
      Gdx.input.setCursorCatched(false);
      if (t instanceof RuntimeException)
        throw (RuntimeException)t;
      else
        throw new GdxRuntimeException(t);
    }
  }
};

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

@Override
  public void run () {
    graphics.setVSync(graphics.config.vSyncEnabled);
    try {
      LwjglApplication.this.mainLoop();
    } catch (Throwable t) {
      if (audio != null) audio.dispose();
      Gdx.input.setCursorCatched(false);
      if (t instanceof RuntimeException)
        throw (RuntimeException)t;
      else
        throw new GdxRuntimeException(t);
    }
  }
};

代码示例来源:origin: mstojcevich/Radix

public void handleCriticalException(Exception ex) {
  ex.printStackTrace();
  this.done = true;
  Gdx.input.setCursorCatched(false);
  if(!android) {
    JOptionPane.showMessageDialog(null, GAME_TITLE + " crashed. " + String.valueOf(ex), GAME_TITLE + " crashed", JOptionPane.ERROR_MESSAGE);
  }
}

代码示例来源:origin: mstojcevich/Radix

public void setCurrentScreen(GuiScreen screen) {
  if (currentScreen == null) {
    currentScreen = screen;
    screen.init();
  } else if (!currentScreen.equals(screen)) {
    currentScreen.finish();
    currentScreen = screen;
    screen.init();
  }
  if (screen.equals(hud) && !android) {
    Gdx.input.setCursorCatched(true);
  } else {
    Gdx.input.setCursorCatched(false);
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

@Override
  public void run () {
    graphics.setVSync(graphics.config.vSyncEnabled);
    try {
      LwjglApplication.this.mainLoop();
    } catch (Throwable t) {
      if (audio != null) audio.dispose();
      Gdx.input.setCursorCatched(false);
      if (t instanceof RuntimeException)
        throw (RuntimeException)t;
      else
        throw new GdxRuntimeException(t);
    }
  }
};

代码示例来源:origin: org.mini2Dx/mini2Dx-desktop

@Override
  public void run() {
    graphics.setVSync(graphics.config.vSyncEnabled);
    try {
      DesktopMini2DxGame.this.executeGame();
    } catch (Throwable t) {
      if (audio != null)
        audio.dispose();
      Gdx.input.setCursorCatched(false);
      if (t instanceof RuntimeException)
        throw (RuntimeException) t;
      else
        throw new GdxRuntimeException(t);
    }
  }
};

代码示例来源:origin: mstojcevich/Radix

done = true;
e.printStackTrace();
Gdx.input.setCursorCatched(false);
Gdx.app.exit();

相关文章