本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.SpriteBatch.begin方法的典型用法代码示例。如果您正苦于以下问题:Java SpriteBatch.begin方法的具体用法?Java SpriteBatch.begin怎么用?Java SpriteBatch.begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch spriteBatch) {
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
//spriteBatch.draw(backGround, camera.position.x - (camera.viewportWidth / 2), 0);
backGround.render(spriteBatch);
spriteBatch.draw(chapa.getTexture(), chapa.getPosition().x, chapa.getPosition().y);
for (Tube tube : tubes) {
spriteBatch.draw(tube.getTopTube(), tube.getPosTopTube().x, tube.getPosTopTube().y);
spriteBatch.draw(tube.getBottomTube(), tube.getPosBotTube().x, tube.getPosBotTube().y);
}
anto.render(spriteBatch);
// spriteBatch.draw(ground, groundPos1.x, groundPos1.y);
// spriteBatch.draw(ground, groundPos2.x, groundPos2.y);
//table.draw(spriteBatch,1f);
scoreLabel.draw(spriteBatch,1);
spriteBatch.end();
}
示例2: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
sb.setProjectionMatrix(camera.combined);
sb.begin();
sb.draw(bg, camera.position.x - (camera.viewportWidth / 2), 0);
sb.draw(bird.getBird(), bird.getPosition().x, bird.getPosition().y);
for (com.kirdmiv.flappybaranus.sprites.Tube tube : tubes) {
sb.draw(tube.getTopTube(), tube.getPosBotTube().x, tube.getPosTopTube().y);
sb.draw(tube.getBottomTube(), tube.getPosBotTube().x, tube.getPosBotTube().y);
}
sb.draw(ground, groundPos1.x, groundPos1.y);
sb.draw(ground, groundPos2.x, groundPos2.y);
font.draw(sb, Integer.toString(score), camera.position.x, 370);
sb.end();
}
示例3: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
sb.setProjectionMatrix(camera.combined);
sr.setAutoShapeType(true);
sr.setProjectionMatrix(camera.combined);
//SHAPERENDERER
sr.begin();
sr.set(ShapeRenderer.ShapeType.Filled);
sr.setColor(new Color(23 / 255f, 23 / 255f, 23 / 255f, 1f));
sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
for (int i = 0; i < background.length; i++) {
background[i].renderSR(sr);
}
play.renderSR(sr);
music.renderSR(sr);
sr.end();
//SPRITEBATCH
sb.begin();
sb.draw(logo, Game.WIDTH / 2 - (logo.getTexture().getWidth() * 10) / 2, Game.HEIGHT - 50 - logo.getHeight() * 10, logo.getWidth() * 10, logo.getHeight() * 10);
play.renderSB(sb);
music.renderSB(sb);
betaText.draw(sb, "Beta Release - Copyright 2017 Gussio. All rights reserved. Visit https://gussio.nl/ for more info.", 10, 25);
sb.end();
}
示例4: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
sb.setProjectionMatrix(camera.combined);
sr.setAutoShapeType(true);
sr.setProjectionMatrix(camera.combined);
//BACKGROUND
sr.begin();
sr.set(ShapeRenderer.ShapeType.Filled);
sr.setColor(Color.WHITE);
sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
sr.end();
//LOGO
sb.begin();
sb.draw(logo, Game.WIDTH / 2 - logo.getWidth() * 20 / 2, Game.HEIGHT / 2 - logo.getHeight() * 20 / 2, logo.getWidth() * 20, logo.getHeight() * 20);
sb.end();
}
示例5: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void render(SpriteBatch batch) {
if (MyGdxGame.rankings == null || MyGdxGame.rankings.size() == 0) {
return;
}
batch.begin();
for (int i = 0; i < MyGdxGame.rankings.size(); i++) {
mFont.draw(batch, (i + 1) + ".", x * MyGdxGame.WEIGHT_RATE - 175, y * MyGdxGame.HEIGHT_RATE + 50 - i * 80);
mFont.draw(batch, MyGdxGame.rankings.get(i).name, x * MyGdxGame.WEIGHT_RATE - 95, y * MyGdxGame.HEIGHT_RATE + 50 - i * 80);
mFont.draw(batch, MyGdxGame.rankings.get(i).score + "", x * MyGdxGame.WEIGHT_RATE - 95 + 140, y * MyGdxGame.HEIGHT_RATE + 50 - i * 80);
mFont.draw(batch, MyGdxGame.rankings.get(i).time + "秒", x * MyGdxGame.WEIGHT_RATE - 95 + 235, y * MyGdxGame.HEIGHT_RATE + 50 - i * 80);
}
batch.end();
}
示例6: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void render(SpriteBatch batch, OrthographicCamera screenCamera) {
batch.setShader(null);
batch.setProjectionMatrix(screenCamera.combined);
batch.begin();
batch.draw(pixelBufferRegion, 0, 0, screenCamera.viewportWidth, screenCamera.viewportHeight);
batch.end();
}
示例7: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void render(SpriteBatch batch, float delta) {
update(delta);
batch.begin();
batch.draw(mRegion, x * Constant.RATE - mRegion.getRegionWidth() / 2
, y * Constant.RATE - mRegion.getRegionHeight() / 2);
batch.end();
}
示例8: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
//sb.setProjectionMatrix(cam.combined);
sb.begin();
sb.draw(menu, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
stage.draw();
sb.end();
// if (Gdx.input.isTouched()) {
//
//
// Gdx.app.log("LOG", "Coords: " + Gdx.input.getX()+ " , " + Gdx.input.getY() );
// Gdx.app.debug("MyTag", "my debug message");
// System.out.println("logging coords: " + Gdx.input.getX()+ " , " + Gdx.input.getY());
//
// if (Gdx.input.getX() > 114 && Gdx.input.getX() < 205 && // This is the top-left corner of the button
// Gdx.input.getY() < 147 && Gdx.input.getY() > 187) { // This is the bottom-right corner of the button
//
// // DO STUFF HERE WHEN BUTTON 1 PRESSED!!
// handleInput();
// Gdx.app.log("LOG", "play pressed");
//
//
// } else if (Gdx.input.getX() > 193 && Gdx.input.getX() < 510 && // This is the top-left corner of the button
// Gdx.input.getY() < 441 && Gdx.input.getY() > 498) { // This is the bottom-right corner of the button
//
// // DO STUFF HERE WHEN BUTTON 2 PRESSED!!
// System.out.println("Options pressed");
//
// }
}
示例9: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch spriteBatch) {
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
spriteBatch.draw(backGround, 0, 0);
spriteBatch.draw(gameOver, camera.position.x - gameOver.getWidth() / 2, camera.position.y);
spriteBatch.draw(chapaTriggered, camera.position.x - chapaTriggered.getWidth() / 2, camera.position.y / 1.5f);
spriteBatch.draw(texture, camera.position.x - texture.getWidth() / 2, camera.position.y + 60);
spriteBatch.end();
}
示例10: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch spriteBatch) {
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
spriteBatch.draw(backGround, 0, 0);
spriteBatch.draw(playButton, camera.position.x - playButton.getWidth() / 2, camera.position.y);
spriteBatch.end();
}
示例11: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
sb.setProjectionMatrix(camera.combined);
sb.begin();
sb.draw(background, 0, 0);
sb.draw(playBtn, camera.position.x - playBtn.getWidth() / 2, camera.position.y);
sb.end();
}
示例12: renderGL2
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void renderGL2(float gameTime)
{
GLCommon gl = Gdx.gl;
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
SpriteBatch batch = getSpriteBatch();
viewMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.setProjectionMatrix(viewMatrix);
batch.begin();
batch.disableBlending();
batch.setColor(Color.WHITE);
//begin render background
renderBackground(gameTime);
batch.enableBlending();
batch.end();
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_CULL_FACE);
camera.update();
for(IDrawable3D obj : collection)
if(obj.isVisible())
{
obj.renderGL2(gameTime);
}
gl.glDisable(GL10.GL_CULL_FACE);
gl.glDisable(GL10.GL_DEPTH_TEST);
batch.setProjectionMatrix(viewMatrix);
batch.begin();
//begin render foreground
renderForeground(gameTime);
//batch.enableBlending();
//batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
batch.end();
}
示例13: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
sb.setProjectionMatrix(cam.combined);
sb.begin();
sb.draw(background, 0, 0, GameTutorial.WIDTH, GameTutorial.HEIGHT);
sb.end();
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
示例14: 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();
}
示例15: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void render(SpriteBatch spriteBatch) {
generatePalettes();
paletteTexture.bind(1);
//Clear main framebuffer.
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
//Fill just the 256x240 viewport area with the current bg color
shapeRenderer.setProjectionMatrix(camera.combined);
shapeRenderer.begin();
shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(bgColor);
shapeRenderer.rect(0f, 0f, 256f, 240f);
shapeRenderer.end();
if (ggvm.isBackgroundVisible()) {
sortSprites();
//Draw foreground sprites to a separate framebuffer, where they can be
//optionally clipped by background sprites.
foregroundSpritesFrameBuffer.begin();
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
spriteBatch.setShader(shaderProgram);
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
shaderProgram.setUniformi("u_paletteTexture", 1);
spriteBatch.disableBlending();
drawSprites(spriteBatch, foregroundSprites, isSprTransparentMask, foregroundSpritesCount);
spriteBatch.end();
foregroundSpritesFrameBuffer.end();
viewPort.apply();
mainFrameBuffer.begin();
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
//Draw background sprites, nametable, then blend
//the foreground sprites framebuffer to the main framebuffer.
spriteBatch.begin();
spriteBatch.enableBlending();
drawSprites(spriteBatch, backgroundSprites, isBgTransparentMask, backgroundSpritesCount);
drawNametable(ggvm, spriteBatch);
spriteBatch.setShader(null);
spriteBatch.draw(foregroundSpritesTextureRegion, 0, 0);
rasterEffectManager.render(spriteBatch);
spriteBatch.end();
mainFrameBuffer.end();
viewPort.apply();
spriteBatch.begin();
spriteBatch.draw(mainTextureRegion, 0, 0);
spriteBatch.end();
if (ggvm.isBackgroundClipping()) {
shapeRenderer.setProjectionMatrix(camera.combined);
shapeRenderer.begin();
shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(bgColor);
shapeRenderer.rect(0f, 0f, 8f, 240f);
shapeRenderer.end();
}
}
fpsLogger.log();
}