本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.SpriteBatch.setProjectionMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java SpriteBatch.setProjectionMatrix方法的具体用法?Java SpriteBatch.setProjectionMatrix怎么用?Java SpriteBatch.setProjectionMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.setProjectionMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawTextures
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
private void drawTextures(SpriteBatch spriteBatch) {
spriteBatch.setProjectionMatrix(overlayCamera.combined);
spriteBatch.begin();
if (!ggVmRegisterHideMobileButtons.getHideDPad()) {
drawCenteredTexture(spriteBatch, dpadTexture, DPAD_X * scale, DPAD_Y * scale, 100 * scale, 100 * scale);
}
if (!ggVmRegisterHideMobileButtons.getHideSelect()) {
drawCenteredTexture(spriteBatch, ssTexture, SELECT_X * scale, SELECT_Y * scale, 40 * scale, 20 * scale);
}
if (!ggVmRegisterHideMobileButtons.getHideStart()) {
drawCenteredTexture(spriteBatch, ssTexture, 424 + START_X * scale, START_Y * scale, 40 * scale, 20 * scale);
}
drawCenteredTexture(spriteBatch, ssTexture, SIZE_TOGGLE_X , 240 + SIZE_TOGGLE_Y , 40, 20);
if (!ggVmRegisterHideMobileButtons.getHideA()) {
drawCenteredTexture(spriteBatch, abTexture, 424 + A_X * scale, A_Y * scale, 40 * scale, 40 * scale);
}
if (!ggVmRegisterHideMobileButtons.getHideB()) {
drawCenteredTexture(spriteBatch, abTexture, 424 + B_X * scale, B_Y * scale, 40 * scale, 40 * scale);
}
spriteBatch.end();
}
示例2: GameRenderer
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public GameRenderer(GameWorld world, int gameHeight, int midPointY) {
myWorld = world;
this.gameHeight = gameHeight;
this.midPointY = midPointY;
cam = new OrthographicCamera();
cam.setToOrtho(true, 136, gameHeight);
batcher = new SpriteBatch();
batcher.setProjectionMatrix(cam.combined);
shapeRenderer = new ShapeRenderer();
shapeRenderer.setProjectionMatrix(cam.combined);
// Call helper methods to initialize instance variables.
initGameObjects();
initAssets();
}
示例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();
}
示例4: 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);
}
示例5: 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();
}
示例6: DeathScreen
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public DeathScreen(Polymorph polymorph,int playerscore) {
AssetManager assetManager = polymorph.getAssetManager();
TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
this.polymorph = polymorph;
score=playerscore;
DeathScreenMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH);
DeathScreenMusic.setLooping(true);
background = textureAtlas.findRegion("mainmenu"); //TODO make a unique background for the death screen
screenSize = new Dimension(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera = new OrthographicCamera();
camera.setToOrtho(false, screenSize.width, screenSize.height); //change this
batch=new SpriteBatch();
batch.setProjectionMatrix(camera.combined);
stage = new Stage();
stage.clear();
font = new BitmapFont(false);
textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
initButtons(score,textureAtlas);
Gdx.input.setInputProcessor(stage);
}
示例7: render
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch spriteBatch) {
if (!ggvm.isAlive()) {
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
menu.render(spriteBatch);
spriteBatch.end();
}
}
示例8: GameRenderer
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public GameRenderer(GameWorld world) {
this.world = world;
this.cam = new OrthographicCamera();
cam.setToOrtho(true, com.home.knowhunt.screens.GameScreen.GAME_WIDTH, 204);
batcher = new SpriteBatch();
batcher.setProjectionMatrix(cam.combined);
shapeRenderer = new ShapeRenderer();
shapeRenderer.setProjectionMatrix(cam.combined);
initGameObjects();
}
示例9: renderWorld
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
public void renderWorld(SpriteBatch batch) {
worldController.cameraHelper.applyTo(camera);
batch.setProjectionMatrix(camera.combined);
batch.begin();
worldController.level.render(batch);
batch.end();
}
示例10: renderGui
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
private void renderGui(SpriteBatch batch) {
batch.setProjectionMatrix(cameraGUI.combined);
batch.begin();
renderGuiScore(batch);
renderGuiExtraLives(batch);
renderGuiFpsCounter(batch);
batch.end();
}
示例11: 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();
}
示例12: 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();
}
示例13: 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();
}
示例14: 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();
}
示例15: 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();
}