com.badlogic.gdx.scenes.scene2d.Stage.getBatch()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(121)

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

Stage.getBatch介绍

暂无

代码示例

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

public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
    if (stage.getBatch().isBlendingEnabled())
      stage.getBatch().disableBlending();
    else
      stage.getBatch().enableBlending();
    return true;
  }
});

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

public void render () {
  // System.out.println(meow.getValue());
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
  stage.getBatch().begin();
  patch.draw(stage.getBatch(), 300, 100, 126, 126);
  stage.getBatch().end();
}

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

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

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

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

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

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

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

public void render () {
  Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
  long now = TimeUtils.nanoTime();
  sampleFrames++;
  if (now - sampleStartTime > 1000000000) {
    if (sampleStartTime != 0) {
      int renderCalls = ((SpriteBatch)stage.getBatch()).renderCalls;
      Gdx.app.log("CpuSpriteBatch", "FPS: " + sampleFrames + ", render calls: " + renderCalls);
    }
    sampleStartTime = now;
    sampleFrames = 0;
  }
}

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

if (text.length() > 4) text = text.substring(0, text.lastIndexOf('.') + 3);
text = "duration: " + text + " s (ctrl + scroll to change)";
stage.getBatch().begin();
list.getStyle().font.draw(stage.getBatch(), text, bottomLeftX + graphSize / 2, bottomLeftY + graphSize
  + list.getStyle().font.getLineHeight(), 0, Align.center, false);
stage.getBatch().end();

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

stage.getBatch().disableBlending();
Group root = stage.getRoot();
Array<Actor> actors = root.getChildren();

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

@Override
public void render(boolean inGame, SpriteBatch guiBatch) {
  stage.getBatch().begin();
  stage.getBatch().draw(background, 0, 0, stage.getWidth(), stage.getHeight(), 0, 0, stage.getWidth()/background.getWidth(), stage.getHeight()/background.getHeight());
  stage.getBatch().end();
  stage.draw();
}

代码示例来源:origin: dingjibang/GDX-RPG

public void draw() {
  Batch batch = stage.getBatch();
  
  if(map.renderable && map.loaded()){
    map.draw(batch);//画地图
    
    stage.draw();//画UI
  }
  
  fg.draw(batch);
  msg.draw(batch);
}

代码示例来源:origin: Var3D/var3dframe

public Batch batchBegin() {
  Batch batch = super.getBatch();
  batch.begin();
  batch.setColor(Color.WHITE);
  oldTransform.set(batch.getTransformMatrix());
  batch.setTransformMatrix(computeTransform());
  return batch;
}

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

public TextureRegion getBgIcon(String atlas, String region) {
  // check here for dispose instead in project loading because the opengl
  // context lost in new project thread
  if (disposeBgCache) {
    dispose();
    disposeBgCache = false;
  }
  String s = atlas + "#" + region;
  TextureRegion icon = bgIconCache.get(s);
  if (icon == null) {
    Batch batch = getStage().getBatch();
    batch.end();
    try {
      icon = createBgIcon(atlas, region);
    } catch (Exception e) {
      EditorLogger.error("Error creating Background icon: " + atlas + "." + region);
    }
    if (icon == null) {
      EditorLogger.error("Error creating Background icon: " + atlas + "." + region);
      icon = Ctx.assetManager.getIcon("ic_no_scene");
    }
    bgIconCache.put(s, icon);
    batch.begin();
  }
  return icon;
}

代码示例来源:origin: LonamiWebs/Klooni1010

@Override
public void render(float delta) {
  Klooni.theme.glClearBackground();
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Math.min(Gdx.graphics.getDeltaTime(), MIN_DELTA));
  stage.draw();
  // After everything is drawn, showcase the current shop item
  SnapshotArray<Actor> children = shopGroup.getChildren();
  if (children.size > 0) {
    final ShopCard card = (ShopCard) children.get(showcaseIndex);
    final Batch batch = stage.getBatch();
    batch.begin();
    // For some really strange reason, we need to displace the particle effect
    // by "buyBand.height", or it will render exactly that height below where
    // it should.
    // TODO Fix this - maybe use the same project matrix as stage.draw()?
    // batch.setProjectionMatrix(stage.getViewport().getCamera().combined)
    if (!card.showcase(batch, buyBand.getHeight())) {
      showcaseIndex = (showcaseIndex + 1) % children.size;
    }
    batch.end();
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
    goBack();
  }
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

@Override
protected void initialize() {
  camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  camera.setToOrtho(false);
  camera.update();
  renderer = new ShapeRenderer();
  stage = new Stage();
  stage.getBatch().setProjectionMatrix(camera.combined);
  skin = new Skin(Gdx.files.classpath("net/mostlyoriginal/plugin/profiler/skin/uiskin.json"));
  // setup some static config like colors etc
  SystemProfilerGUI.GRAPH_H_LINE.set(Color.ORANGE);
  gui = new SystemProfilerGUI(skin, "default");
  gui.setResizeBorder(8);
  gui.show(stage);
  gui.setWidth(Gdx.graphics.getWidth());
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-profiler

@Override
protected void initialize() {
  camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  camera.setToOrtho(false);
  camera.update();
  renderer = new ShapeRenderer();
  stage = new Stage();
  stage.getBatch().setProjectionMatrix(camera.combined);
  skin = new Skin(Gdx.files.classpath("net/mostlyoriginal/plugin/profiler/skin/uiskin.json"));
  // setup some static config like colors etc
  SystemProfilerGUI.GRAPH_H_LINE.set(Color.ORANGE);
  gui = new SystemProfilerGUI(skin, "default");
  gui.setResizeBorder(8);
  gui.show(stage);
  gui.setWidth(Gdx.graphics.getWidth());
}

相关文章