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

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

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

Graphics.setContinuousRendering介绍

[英]Sets whether to render continuously. In case rendering is performed non-continuously, the following events will trigger a redraw:

  • A call to #requestRendering()
  • Input events from the touch screen/mouse or keyboard
  • A Runnable is posted to the rendering thread via Application#postRunnable(Runnable). In the case of a multi-window app, all windows will request rendering if a runnable is posted to the application. To avoid this, post a runnable to the window instead.
    Life-cycle events will also be reported as usual, see ApplicationListener. This method can be called from any thread.
    [中]设置是否连续渲染。如果非连续执行渲染,以下事件将触发重画:
    *对#requestRendering()的调用
    *从触摸屏/鼠标或键盘输入事件
    *Runnable通过应用程序#postRunnable(Runnable)发布到渲染线程。对于多窗口应用程序,如果向应用程序发布了runnable,则所有窗口都将请求渲染。为了避免这种情况,将runnable发布到窗口。
    生命周期事件也将照常报告,请参阅ApplicationListener。此方法可以从任何线程调用。

代码示例

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

@Override
public void create () {
  // disable continuous rendering
  Gdx.graphics.setContinuousRendering(false);
  Gdx.app.log("DirtyRenderingTest", "created");
}

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

public void changed (ChangeEvent event, Actor actor) {
    Gdx.graphics.setContinuousRendering(checkBox.isChecked());
  }
});

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

public void changed (ChangeEvent event, Actor actor) {
    boolean continuous = Gdx.graphics.isContinuousRendering();
    Gdx.graphics.setContinuousRendering(!continuous);
  }
});

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

@Override
public void create () {
  batch = new SpriteBatch();
  texture = new Texture("data/badlogic.jpg");
  region = new TextureRegion(texture);
  stage = new Stage(new ScreenViewport(), batch);
  Gdx.input.setInputProcessor(stage);
  skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  skin.add("default", font = new BitmapFont(Gdx.files.internal("data/arial-32.fnt"), false));
  populateTable();
  
  Gdx.graphics.setContinuousRendering(false);
  Gdx.graphics.requestRendering();
}

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

@Override
public void create() {
  if (params.debug) {
    Gdx.app.log(TAG, "Application is running in DEBUG mode.");
  }
  Gdx.app.getGraphics().setContinuousRendering(false);
  Gdx.input.setInputProcessor(inputMultiplexer);
  initiateContext();
  FileChooser.setSaveLastDirectory(true);
  FileChooser.setDefaultPrefsName("file_chooser.xml");
  // Uncomment to update project's LML DTD schema
  // LmlUtils.saveDtdSchema(interfaceService.getParser(), Gdx.files.local("../lml.dtd"));
}

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

private void setupOGL() {
  camera = new PerspectiveCamera(90, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  camera.position.set(10f, 150f, 10f);
  camera.lookAt(0, 0, 0);
  camera.near = 0.1f;
  camera.far = 450f;
  camera.update();
  hudCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  guiBatch = new SpriteBatch();
  guiBatch.setProjectionMatrix(hudCamera.combined);
  if(android) {
    setupTouchControls();
  }
  Gdx.input.setInputProcessor(new RadixInputHandler(this));
  if(settingsManager.getVisualSettings().getNonContinuous().getValue()) {
    Gdx.graphics.setContinuousRendering(false);
  }
  sceneTheme = new SceneTheme();
  sceneTheme.init();
}

相关文章