本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.SpriteBatch.flush方法的典型用法代码示例。如果您正苦于以下问题:Java SpriteBatch.flush方法的具体用法?Java SpriteBatch.flush怎么用?Java SpriteBatch.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void draw(GameTime time, SpriteBatch batch) {
// set camera projection matrix
batch.setProjectionMatrix(game.getUICamera().combined);
// draw background
batch.draw(this.bgImage, 0, 0, game.getViewportWidth(), game.getViewportHeight());
// draw first (SpriteBatch) layer of HUD
this.hud.drawLayer0(time, batch);
batch.flush();
batch.end();
// draw second layer (ShapeRenderer) of HUD
this.shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
this.shapeRenderer.setProjectionMatrix(game.getUICamera().combined);
this.hud.drawLayer1(time, this.shapeRenderer);
this.shapeRenderer.end();
// draw last (SpriteBatch) layer of HUD
batch.begin();
batch.setProjectionMatrix(game.getUICamera().combined);
this.hud.drawLayer2(time, batch);
}
示例2: draw
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void draw(GameTime time, SpriteBatch batch) {
// draw skybox
this.skyBox.draw(time, game.getCamera(), batch);
// set camera projection matrix
batch.setProjectionMatrix(game.getCamera().getCombined());
// draw entities
this.ecs.draw(time, game.getCamera(), batch);
// reset shader
batch.setShader(null);
batch.setProjectionMatrix(game.getCamera().getCombined());
// draw abilities and so on
this.ecs.drawUILayer(time, game.getCamera(), batch);
batch.flush();
// reset shader, so default shader is used
batch.setShader(null);
batch.end();
this.shapeRenderer.setProjectionMatrix(game.getCamera().getCombined());
this.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
this.shapeRenderer.setColor(Color.BLACK);
// draw collision boxes
if (debug) {
this.collisionManager.drawCollisionBoxes(time, game.getCamera(), shapeRenderer, COLLISION_BOX_COLOR,
IN_COLLISION_COLOR);
}
this.shapeRenderer.end();
batch.begin();
}
示例3: draw
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void draw(GameTime time, SpriteBatch batch) {
// set UI camera
batch.setProjectionMatrix(game.getUICamera().combined);
// draw time text
if (seconds >= 0 && seconds <= 3 && this.elapsedTime > 5000) {
this.font2.draw(batch, this.timeText, game.getViewportWidth() - 220, game.getViewportHeight() - 50);
} else {
this.font1.draw(batch, this.timeText, game.getViewportWidth() - 220, game.getViewportHeight() - 50);
}
// draw ammo hud
this.font2.draw(batch, this.torpedoAmountText, game.getViewportWidth() - 220, 70);
this.font1.draw(batch, this.torpedoAmountText, game.getViewportWidth() - 220, 70);
// draw score
font2.draw(batch, scoreText, 30, game.getViewportHeight() - 50);
font1.draw(batch, scoreText, 30, game.getViewportHeight() - 50);
// draw first (SpriteBatch) layer of HUD
this.hud.drawLayer0(time, batch);
batch.flush();
batch.end();
// draw second layer (ShapeRenderer) of HUD
this.shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
this.shapeRenderer.setProjectionMatrix(game.getUICamera().combined);
this.hud.drawLayer1(time, this.shapeRenderer);
this.shapeRenderer.end();
this.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
this.shapeRenderer.setColor(Color.WHITE);
this.shapeRenderer.rect(game.getViewportWidth() - 100, 20, 80, 80);
this.shapeRenderer.end();
// draw last (SpriteBatch) layer of HUD
batch.begin();
batch.setProjectionMatrix(game.getUICamera().combined);
this.hud.drawLayer2(time, batch);
// draw torpedo, if available
if (weaponInvComponent.canShootNowWithRightWeapon()) {
batch.draw(this.torpedoTexture, game.getViewportWidth() - 91, 30);
}
}