当前位置: 首页>>代码示例>>Java>>正文


Java SpriteBatch.end方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.SpriteBatch.end方法的典型用法代码示例。如果您正苦于以下问题:Java SpriteBatch.end方法的具体用法?Java SpriteBatch.end怎么用?Java SpriteBatch.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g2d.SpriteBatch的用法示例。


在下文中一共展示了SpriteBatch.end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(final SpriteBatch sb) {
    sb.setProjectionMatrix(cam.combined);
    sb.begin();
    sb.draw(background, 0, 0, GameTutorial.WIDTH, GameTutorial.HEIGHT);
    sb.draw(apple.getObsAnimation(), apple.getPosObs().x, apple.getPosObs().y, 100, 100);
    sb.draw(cherry.getObsAnimation(), cherry.getPosObs().x, cherry.getPosObs().y, 250, 160);
    sb.draw(carrot.getObsAnimation(), carrot.getPosObs().x, carrot.getPosObs().y, 150, 91);
    sb.draw(barrel, 580, 60, 80, 80);
    sb.draw(car, 400, 60, 150, 80);
    sb.draw(hayBale, 660, 45, 100, 100);
    sb.draw(sheep.getSheep(), sheep.getPosition().x, sheep.getPosition().y, 140, 90);
    if (farmer.collides(theOneThatDies.getBounds1())) {
        sb.draw(theOneThatDies.getSheepDead(), theOneThatDies.getPosition().x, 220, 140, 90);
        theOneThatDies.noSpd();
    }
    else {
        sb.draw(theOneThatDies.getSheep(), theOneThatDies.getPosition().x, 220, 140,90);
        theOneThatDies.noSpd();
    }
    sb.draw(farmer.getFarmer(), farmer. getPosition().x, 220, 180, 180);
    sb.end();
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:24,代码来源:Instruction.java

示例2: 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();

    }
 
开发者ID:RubenMateus,项目名称:FlappyChapa,代码行数:24,代码来源:PlayState.java

示例3: 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();

}
 
开发者ID:kirdmiv,项目名称:Flappy-Baranus,代码行数:17,代码来源:PlayState.java

示例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);
    //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();
}
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:26,代码来源:MenuScreen.java

示例5: renderProgressBar

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void renderProgressBar(SpriteBatch batch) {
	batch.begin();
	batch.draw(backgroundImg, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	batch.draw(progressBarBaseImg, pbPos.x, pbPos.y);
	batch.draw(progressBarImg, pbPos.x,pbPos.y,progressBarImg.getWidth()*getProgress(),progressBarImg.getHeight());
	font.draw(batch, "[BLACK]Loading...", pbPos.x+5, pbPos.y+progressBarImg.getHeight() - 10);
	batch.end();
}
 
开发者ID:Arcxes,项目名称:CursedEcho,代码行数:9,代码来源:AssetHandler.java

示例6: 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");
//
//            }



    }
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:34,代码来源:MenuState.java

示例7: draw

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void draw(SpriteBatch spriteBatch, float delta) {
    Gdx.gl.glClearColor(0, 113/255.0f, 188/255.0f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    
    camera.update();
    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    manager.draw(spriteBatch, delta);
    spriteBatch.end();
    
    stage.draw();
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:14,代码来源:GameState.java

示例8: 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(gameover, camera.position.x - gameover.getWidth() / 2, camera.position.y);
    font.draw(sb, "Your score: " + score, camera.position.x, 170);
    font.draw(sb, "Your highscore: " + highscore, camera.position.x, 150);
    sb.end();

}
 
开发者ID:kirdmiv,项目名称:Flappy-Baranus,代码行数:12,代码来源:GameOver.java

示例9: 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();
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:39,代码来源:BaseGameScene3D.java

示例10: render

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
    sb.setProjectionMatrix(cam.combined);
    sb.begin();
    sb.draw(bg, 0, 0, GameTutorial.WIDTH, GameTutorial.HEIGHT);
    sb.end();

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:12,代码来源:CharacterState.java

示例11: 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();
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:9,代码来源:Tao.java

示例12: render

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
    sb.setProjectionMatrix(cam.combined);
    sb.begin();
    sb.draw(black, 0, 0, GameTutorial.WIDTH, GameTutorial.HEIGHT);
    sb.end();

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:12,代码来源:GameOver.java

示例13: render

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
    sb.setProjectionMatrix(cam.combined);
    sb.begin();
    sb.draw(bg, 0, 0, GameTutorial.WIDTH, GameTutorial.HEIGHT);
    //sb.draw(bg, 0, 0, 256,180);
    sb.end();

    stage.act(Gdx.graphics.getDeltaTime()); //Perform ui logic
    stage.draw();

}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:13,代码来源:MapState.java

示例14: 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();
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:69,代码来源:RenderManager.java

示例15: render

import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb) {
    sb.begin();
    sb.setProjectionMatrix(cam.combined);
    sb.draw(sky, skyPos.x, 0, 1024, 400);
    sb.draw(sky, skyPos2.x, 0, 1024, 400);
    sb.draw(hills, hillsPos.x, 0, hills_width, 250);
    sb.draw(hills, hillsPos2.x, 0, hills_width, 250);
    sb.draw(hills, hillsPos3.x, 0, hills_width, 250);
    sb.draw(hills, hillsPos4.x, 0, hills_width, 250);
    sb.draw(hills, hillsPos5.x, 0, hills_width, 250);
    sb.draw(ground, groundPos1.x, 0, ground_width, 1100);
    sb.draw(ground, groundPos2.x, 0, ground_width, 1100);
    sb.draw(ground, groundPos3.x, 0, ground_width, 1100);
    sb.draw(mud.getObstacle(), mud.getPosObs().x, mud.getPosObs().y);
    if (carrotIsTouched == false) {
        sb.draw(carrot.getObsAnimation(), carrot.getPosObs().x, carrot.getPosObs().y,30,30);
    }
    sb.draw(spikes.getObsAnimation(), spikes.getPosObs().x, spikes.getPosObs().y);
    //CHARACTERS
    if (a == 1){
        if (farmer.collides(sheep.getBounds1())) {
            sb.draw(sheep.getSheepDead(), sheep.getPosition().x, sheep.getPosition().y, 70, 45);
        } else {
            sb.draw(sheep.getSheep(), sheep.getPosition().x, sheep.getPosition().y, 70, 45);
        }
    }
    if (a == 2){
        if (farmer.collides(cow.getCowBounds())) {
            sb.draw(cow.getCowDead(), cow.getPosition().x, cow.getPosition().y, 70, 45);
        } else {
            sb.draw(cow.getCow(), cow.getPosition().x, cow.getPosition().y, 70, 45);
        }
    }
    if (a == 3){
        if (farmer.collides(pig.getPigBounds())) {
            sb.draw(pig.getPigDead(), pig.getPosition().x, pig.getPosition().y, 70, 45);
        } else {
            sb.draw(pig.getPig(), pig.getPosition().x, pig.getPosition().y, 70, 45);
        }
    }
    if (a == 4){
        if (farmer.collides(bunny.getBoundsBunny())) {
            sb.draw(bunny.getBunnyDead(), bunny.getPosition().x, bunny.getPosition().y, 50,50);
        } else {
            sb.draw(bunny.getBunny(), bunny.getPosition().x, bunny.getPosition().y, 50, 50);
        }
    }
    if (a == 5){
        if (farmer.collides(chick.getChickBounds())) {
            sb.draw(chick.getChickDead(), chick.getPosition().x, chick.getPosition().y, 32, 32);
        } else {
            sb.draw(chick.getChick(), chick.getPosition().x, chick.getPosition().y, 32, 32);
        }
    }
    sb.draw(farmer.getFarmer(), farmer.getPosition().x, farmer.getPosition().y,120,110);
    sb.end();

    //Text to display countdown timer!1!1!
    batch.begin();
    font.setColor(Color.WHITE);
    font.getData().setScale(2, 2);
    font.draw(batch, ((41000 - (System.currentTimeMillis() - startTime)) / 1000) + " ", GameTutorial.WIDTH / 2, GameTutorial.HEIGHT);
    batch.end();
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:66,代码来源:Level3.java


注:本文中的com.badlogic.gdx.graphics.g2d.SpriteBatch.end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。