org.lwjgl.opengl.Display.getPixelScaleFactor()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(122)

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

Display.getPixelScaleFactor介绍

暂无

代码示例

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

public int getX () {
  return (int)(Mouse.getX() * Display.getPixelScaleFactor());
}

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

public int getX () {
  return (int)(Mouse.getX() * Display.getPixelScaleFactor());
}

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

public int getWidth () {
  if (canvas != null)
    return Math.max(1, canvas.getWidth());
  else
    return (int)(Display.getWidth() * Display.getPixelScaleFactor());
}

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

public int getHeight () {
  if (canvas != null)
    return Math.max(1, canvas.getHeight());
  else
    return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}

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

public int getWidth () {
  if (canvas != null)
    return Math.max(1, canvas.getWidth());
  else
    return (int)(Display.getWidth() * Display.getPixelScaleFactor());
}

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

public int getHeight () {
  if (canvas != null)
    return Math.max(1, canvas.getHeight());
  else
    return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}

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

public int getY () {
  return Gdx.graphics.getHeight() - 1 - (int)(Mouse.getY() * Display.getPixelScaleFactor());
}

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

public int getY () {
  return Gdx.graphics.getHeight() - 1 - (int)(Mouse.getY() * Display.getPixelScaleFactor());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void printContextInitInfo() {
  logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n"
      + " * Graphics Adapter: {2}\n"
      + " * Driver Version: {3}\n"
      + " * Scaling Factor: {4}",
      new Object[]{Sys.getVersion(), Thread.currentThread().getName(),
        Display.getAdapter(), Display.getVersion(),
        Display.getPixelScaleFactor()});
}

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

while (Mouse.next()) {
  events++;
  int x = (int)(Mouse.getEventX() * Display.getPixelScaleFactor());
  int y = Gdx.graphics.getHeight() - (int)(Mouse.getEventY() * Display.getPixelScaleFactor()) - 1;
  int button = Mouse.getEventButton();
  int gdxButton = toGdxButton(button);
  mouseX = event.x;
  mouseY = event.y;
  deltaX = (int)(Mouse.getEventDX() * Display.getPixelScaleFactor());
  deltaY = (int)(Mouse.getEventDY() * Display.getPixelScaleFactor());

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

while (Mouse.next()) {
  events++;
  int x = (int)(Mouse.getEventX() * Display.getPixelScaleFactor());
  int y = Gdx.graphics.getHeight() - (int)(Mouse.getEventY() * Display.getPixelScaleFactor()) - 1;
  int button = Mouse.getEventButton();
  int gdxButton = toGdxButton(button);
  mouseX = event.x;
  mouseY = event.y;
  deltaX = (int)(Mouse.getEventDX() * Display.getPixelScaleFactor());
  deltaY = (int)(Mouse.getEventDY() * Display.getPixelScaleFactor());

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

@Override
public boolean setFullscreenMode (DisplayMode displayMode) {
  org.lwjgl.opengl.DisplayMode mode = ((LwjglDisplayMode)displayMode).mode;
  try {
    if (!mode.isFullscreenCapable()) {
      Display.setDisplayMode(mode);
    } else {
      Display.setDisplayModeAndFullscreen(mode);
    }
    float scaleFactor = Display.getPixelScaleFactor();
    config.width = (int)(mode.getWidth() * scaleFactor);
    config.height = (int)(mode.getHeight() * scaleFactor);
    if (Gdx.gl != null) Gdx.gl.glViewport(0, 0, config.width, config.height);
    resize = true;
    return true;
  } catch (LWJGLException e) {
    return false;
  }
}

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

@Override
public boolean setFullscreenMode (DisplayMode displayMode) {
  org.lwjgl.opengl.DisplayMode mode = ((LwjglDisplayMode)displayMode).mode;
  try {
    if (!mode.isFullscreenCapable()) {
      Display.setDisplayMode(mode);
    } else {
      Display.setDisplayModeAndFullscreen(mode);
    }
    float scaleFactor = Display.getPixelScaleFactor();
    config.width = (int)(mode.getWidth() * scaleFactor);
    config.height = (int)(mode.getHeight() * scaleFactor);
    if (Gdx.gl != null) Gdx.gl.glViewport(0, 0, config.width, config.height);
    resize = true;
    return true;
  } catch (LWJGLException e) {
    return false;
  }
}

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

graphics.config.y = Display.getY();
if (graphics.resize || Display.wasResized()
  || (int)(Display.getWidth() * Display.getPixelScaleFactor()) != graphics.config.width
  || (int)(Display.getHeight() * Display.getPixelScaleFactor()) != graphics.config.height) {
  graphics.resize = false;
  graphics.config.width = (int)(Display.getWidth() * Display.getPixelScaleFactor());
  graphics.config.height = (int)(Display.getHeight() * Display.getPixelScaleFactor());
  Gdx.gl.glViewport(0, 0, graphics.config.width, graphics.config.height);
  if (listener != null) listener.resize(graphics.config.width, graphics.config.height);

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

graphics.config.y = Display.getY();
if (graphics.resize || Display.wasResized()
  || (int)(Display.getWidth() * Display.getPixelScaleFactor()) != graphics.config.width
  || (int)(Display.getHeight() * Display.getPixelScaleFactor()) != graphics.config.height) {
  graphics.resize = false;
  graphics.config.width = (int)(Display.getWidth() * Display.getPixelScaleFactor());
  graphics.config.height = (int)(Display.getHeight() * Display.getPixelScaleFactor());
  Gdx.gl.glViewport(0, 0, graphics.config.width, graphics.config.height);
  if (listener != null) listener.resize(graphics.config.width, graphics.config.height);

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

float scaleFactor = Display.getPixelScaleFactor();
config.width = (int)(targetDisplayMode.getWidth() * scaleFactor);
config.height = (int)(targetDisplayMode.getHeight() * scaleFactor);

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

float scaleFactor = Display.getPixelScaleFactor();
config.width = (int)(targetDisplayMode.getWidth() * scaleFactor);
config.height = (int)(targetDisplayMode.getHeight() * scaleFactor);

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

public int getWidth () {
  if (canvas != null)
    return Math.max(1, canvas.getWidth());
  else
    return (int)(Display.getWidth() * Display.getPixelScaleFactor());
}

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

public int getHeight () {
  if (canvas != null)
    return Math.max(1, canvas.getHeight());
  else
    return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}

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

void checkScaleFactor () {
 float scaleFactor = Display.getPixelScaleFactor();
 if (scaleFactor != scale().factor) updateViewport(
  new Scale(scaleFactor), Display.getWidth(), Display.getHeight());
}

相关文章