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

x33g5p2x  于2022-01-20 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(141)

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

Graphics.getDisplayMode介绍

暂无

代码示例

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

@Override
public void create () {
  DisplayMode displayMode = Gdx.graphics.getDisplayMode();
  DisplayMode displayModeForMonitor = Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor());
  DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
  DisplayMode[] displayModesForMonitor = Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor());
  Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode() ) : " + displayMode);
  Gdx.app.log("DisplayModeTest",
    "Display mode (using Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()) ) : " + Arrays.toString(displayModes));
  Gdx.app.log("DisplayModeTest",
    "Display mode (using Gdx.graphics.getDisplayModes() ) : " + Arrays.toString(displayModesForMonitor));
  Gdx.app.log("DisplayModeTest",
    "Display mode (using Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()) ): " + displayModeForMonitor);
  assertDisplayModeEquals(displayMode, displayModeForMonitor);
  assertDisplayModesEquals(displayModes, displayModesForMonitor);
}

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

DisplayMode mode = app.getGraphics().getDisplayMode();
if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height))
  || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {

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

DisplayMode mode = app.getGraphics().getDisplayMode();
if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height))
  || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {

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

Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());

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

@Override
  public void clicked (InputEvent event, float x, float y) {
    super.clicked(event, x, y);
    if (isWindowed) {
      isWindowed = false;
      changeModeButton.setText(fullScreenInstructions);
      Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
    } else {
      isWindowed = true;
      changeModeButton.setText(windowedInstructions);
      Gdx.graphics.setWindowedMode(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    }
  }
});

代码示例来源:origin: langurmonkey/gaiasky

mymode = Gdx.graphics.getDisplayMode(m);
GlobalConf.screen.FULLSCREEN_WIDTH = mymode.width;
GlobalConf.screen.FULLSCREEN_HEIGHT = mymode.height;

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  font.draw(batch, "accel: [" + Gdx.input.getAccelerometerX() + "," + Gdx.input.getAccelerometerY() + ","
    + Gdx.input.getAccelerometerZ() + "]\n" + "orientation: " + Gdx.input.getNativeOrientation() + "\n" + "rotation: "
    + Gdx.input.getRotation() + "\n" + "wh: " + Gdx.graphics.getDisplayMode() + "\n", 0, 100);
  batch.end();
}

代码示例来源:origin: langurmonkey/gaiasky

DisplayMode nativeMode = Gdx.graphics.getDisplayMode();
widthValidator = new IntValidator(100, nativeMode.width);
widthField = new OwnTextField(Integer.toString(MathUtils.clamp(GlobalConf.screen.SCREEN_WIDTH, 100, nativeMode.width)), skin, widthValidator);

代码示例来源:origin: org.mapsforge/vtm-gdx

@Override
public int getScreenWidth() {
  return Gdx.graphics.getDisplayMode().width;
}

代码示例来源:origin: org.mapsforge/vtm-gdx

@Override
public int getScreenHeight() {
  return Gdx.graphics.getDisplayMode().height;
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public Main(Editor editor, LwjglApplicationConfiguration cfg) {
  super(editor, cfg);
  Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2),
      Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));
}

代码示例来源:origin: jsjolund/GdxDemo3D

public void toggleFullscreen() {
  if (Gdx.graphics.isFullscreen()) {
    Gdx.app.debug(TAG, "Disabling fullscreen w=" + WIDTH + ", h=" + HEIGHT);
    Gdx.graphics.setWindowedMode(WIDTH, HEIGHT);
  } else {
    Gdx.app.debug(TAG, "Enabling fullscreen w=" + Gdx.graphics.getDisplayMode().width + ", h="
        + Gdx.graphics.getDisplayMode().height);
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
  }
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@Override
public void create() {
  // Gdx.input.setCursorCatched(false);
  if (fullscreen)
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
  
  hideCursor();
  
  super.create();
}

代码示例来源:origin: 00-Evan/shattered-pixel-dungeon-gdx

@Override
public void resize(int width, int height) {
  super.resize(width, height);
  Graphics.DisplayMode mode = Gdx.graphics.getDisplayMode();
  boolean maximized = width >= mode.width || height >= mode.height;
  
  if (!maximized && !SPDSettings.fullscreen()){
    SPDSettings.put(SPDSettings.KEY_WINDOW_WIDTH, width);
    SPDSettings.put(SPDSettings.KEY_WINDOW_HEIGHT, height);
  }
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public void toggleFullScreen() {
  if (!fullscreen) {
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
    fullscreen = true;
  } else {
    Gdx.graphics.setWindowedMode(w.getWidth(), w.getHeight());
    fullscreen = false;
  }
}

代码示例来源:origin: MovingBlocks/DestinationSol

@Override
  public void resize() {
    //If the game has gone from full-screen to windowed
    if (lastFullScreenState && !Gdx.graphics.isFullscreen()) {
      Graphics.DisplayMode mode = Gdx.graphics.getDisplayMode();
      ((Lwjgl3Graphics) Gdx.graphics).getWindow().setPosition(mode.width / 4, mode.height / 4);
    }
    lastFullScreenState = Gdx.graphics.isFullscreen();
  }
}

代码示例来源:origin: 00-Evan/shattered-pixel-dungeon-gdx

public static void fullscreen( boolean value ) {
  if (value) {
    put(KEY_WINDOW_FULLSCREEN, true);
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
  } else {
    int w = getInt(KEY_WINDOW_WIDTH, DEFAULT_WINDOW_WIDTH);
    int h = getInt(KEY_WINDOW_HEIGHT, DEFAULT_WINDOW_HEIGHT);
    put(KEY_WINDOW_FULLSCREEN, false);
    Gdx.graphics.setWindowedMode(w, h);
  }
}

代码示例来源:origin: org.mapsforge/vtm-gdx

@Override
public void create() {
  if (!Parameters.CUSTOM_COORD_SCALE) {
    if (Math.min(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height) > 1080)
      MapRenderer.COORD_SCALE = 4.0f;
  }
  mMap = new MapAdapter();
  mMapRenderer = new MapRenderer(mMap);
  Gdx.graphics.setContinuousRendering(false);
  Gdx.app.setLogLevel(Application.LOG_DEBUG);
  int w = Gdx.graphics.getWidth();
  int h = Gdx.graphics.getHeight();
  mMap.viewport().setViewSize(w, h);
  mMapRenderer.onSurfaceCreated();
  mMapRenderer.onSurfaceChanged(w, h);
  InputMultiplexer mux = new InputMultiplexer();
  if (!Parameters.MAP_EVENT_LAYER2) {
    mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap));
    mux.addProcessor(mGestureDetector);
  }
  mux.addProcessor(new InputHandler(this));
  mux.addProcessor(new MotionHandler(mMap));
  Gdx.input.setInputProcessor(mux);
  createLayers();
}

代码示例来源:origin: lycying/c2d-engine

engineCallback.preLoad(Gdx.graphics.getDisplayMode(), engineConfig.assets);

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2),
    Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));

相关文章