List of usage examples for com.badlogic.gdx.graphics.g2d SpriteBatch draw
@Override
public void draw(TextureRegion region, float x, float y)
From source file:at.juggle.games.counting.gameobjects.Balloon.java
License:Apache License
public void draw(SpriteBatch batch, float delta) { animationTime += delta * 10;/*from w ww . ja v a2 s . co m*/ batch.draw(spriteAnim[((int) (animationTime % spriteAnim.length))], getX(), getY()); }
From source file:at.therefactory.jewelthief.ui.Hud.java
License:Open Source License
public void render(SpriteBatch batch) { font.setColor(Color.DARK_GRAY); buttonShowMenu.renderCaption(batch); font.setColor(Color.BLACK);/*from ww w. ja v a 2 s . c om*/ font.draw(batch, bundle.get(game.getCurrentJewelName()), rectangleHud.getX() + 15, rectangleHud.getY() + yOffsetFromHudY); font.draw(batch, Utils.secondsToTimeString(game.getGameDuration()), rectangleHud.getX() + 370, rectangleHud.getY() + yOffsetFromHudY); stringBuilder.append(Math.max(0, game.getPlayer().getNumMen())).append(" ") .append((game.getPlayer().getNumMen() == 1 ? bundle.get(MAN) : bundle.get(MEN))); font.draw(batch, stringBuilder, rectangleHud.getX() + 415, rectangleHud.getY() + yOffsetFromHudY); stringBuilder.setLength(0); currWidth = 0; indexOfFirstJewelToShow = Utils.within(game.getCurrentLevel(), 0, 13) ? 0 : (short) 13; for (int i = indexOfFirstJewelToShow; i <= game.getCurrentLevel(); i++) { if (i > indexOfFirstJewelToShow) currWidth += jewelsToDisplay[i - 1].getSprite().getWidth() + 5; batch.draw(jewelsToDisplay[i].getSprite(), rectangleHud.getX() + 95 + currWidth, rectangleHud.getY() + (15 - jewelsToDisplay[i].getSprite().getHeight() / 2)); } }
From source file:be.ac.ucl.lfsab1509.bouboule.game.anim.CountDown.java
License:Open Source License
/** * Return the status of the pause => true = pause. *//*from ww w. ja va 2 s.com*/ public boolean draw(final SpriteBatch batch, final float delta) { if (!isLaunched()) { // skip frames before playing a sound iFirstFrames++; return true; } else if (iFirstFrames == WAIT_FRAME && RESUME_AFTER_END) { // RESUME_AFTER_END true only for the countdown iFirstFrames++; // stop playing something next frames GlobalSettings.GAME.countdownSound(); } //we are not in the pause menu if (delta < 1f) { stateTime += delta; } currentFrame = countDownAnimation.getKeyFrame(stateTime, true); batch.draw(currentFrame, GlobalSettings.APPWIDTH / 2 - currentFrame.getRegionWidth() / 2, GlobalSettings.APPHEIGHT / 2 - currentFrame.getRegionHeight() / 2); if (stateTime > N_FRAME * STEPTIME - 0.1f) { if (RESUME_AFTER_END) { GlobalSettings.GAME.setScreenGameResume(); // end of countdown => start the game by launching 'resuming' method } reset(); return false; } return true; }
From source file:be.ac.ucl.lfsab1509.bouboule.game.body.Arena.java
License:Open Source License
/** * draw the Arena object. (bg drawing > Disable Blending) * @param SpriteBatch sp to draw//w w w . j av a 2s . co m * * public void draw(final SpriteBatch sp) { */ @Override public void draw(final SpriteBatch sp) { if (origin != null) { //Ensure that the body image position is set on the origin defined by //the jsonFile Vector2 pos = positionVector.sub(origin); sprite.setPosition(pos.x, pos.y); sprite.setOrigin(origin.x, origin.y); sprite.draw(sp); } else { sp.draw(texture, positionVector.x, positionVector.y); } }
From source file:be.ac.ucl.lfsab1509.bouboule.game.body.Bonus.java
License:Open Source License
/** * (non-Javadoc).// w ww . j ava2s . c om * @see be.ac.ucl.lfsab1509.bouboule.game.body.GameBody# * draw(com.badlogic.gdx.graphics.g2d.SpriteBatch) */ public void draw(final SpriteBatch sp) { if (bIsOpening) setOpeningEffect(sp); else if (entity.isAlive()) { if (origin != null) sprite.draw(sp); else sp.draw(texture, positionVector.x, positionVector.y); } else if (!bKilled) setEndingEffect(sp); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.body.Bouboule.java
License:Open Source License
/** * (non-Javadoc)./*from w w w. j a v a 2s. c o m*/ * @see be.ac.ucl.lfsab1509.bouboule.game.body.GameBody# * draw(com.badlogic.gdx.graphics.g2d.SpriteBatch) */ public void draw(final SpriteBatch sp) { if (entity.isAlive()) { if (origin != null) { //Ensure that the body image position is set on the origin defined by //the jsonFile Vector2 pos = positionVector.cpy(); pos = pos.sub(origin); sprite.setPosition(pos.x, pos.y); sprite.setOrigin(origin.x, origin.y); sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees); sprite.draw(sp); } else { sp.draw(texture, positionVector.x, positionVector.y); } } }
From source file:be.ac.ucl.lfsab1509.bouboule.game.gameManager.GraphicManager.java
License:Open Source License
/** * Draw the Arena > Arena + scoreboard * @param sp : SpriteBatch to draw to//from www .ja v a 2 s . c o m * * draw(SpriteBatch batch) */ public void drawArena(final SpriteBatch batch) { arena.draw(batch); batch.draw(scoreboard, 0, 0); }
From source file:br.cefetmg.games.modelo.Princesa.java
public void render(SpriteBatch batch) { batch.draw(texturaAtual, x, y); }
From source file:ch.coldpixel.game.MapDrawing.java
public void MapRender(SpriteBatch batch) { arrTiles = mapmodel.getArrTiles();/*from w w w.j a v a2s .com*/ for (int i = 0; i < arrTiles.length; i++) { for (int j = 0; j < arrTiles[0].length; j++) { switch (arrTiles[i][j]) { case 0://Nothing break; case 1://Ground batch.draw(ground, i * TILESIZE, j * TILESIZE); break; case 2://GroundTop batch.draw(groundTop, i * TILESIZE, j * TILESIZE); break; //HOUSE1 //Door Left Bottom case 3: batch.draw(house1Door1LeftBottom, i * TILESIZE, j * TILESIZE); break; //Door Left Mid case 4: batch.draw(house1Door1LeftMid, i * TILESIZE, j * TILESIZE); break; //Door Left Top case 5: batch.draw(house1Door1LeftTop, i * TILESIZE, j * TILESIZE); break; //Door Right Bottom case 6: batch.draw(house1Door1RightBottom, i * TILESIZE, j * TILESIZE); break; //Door Right Mid case 7: batch.draw(house1Door1RightMid, i * TILESIZE, j * TILESIZE); break; //Door Right Top case 8: batch.draw(house1Door1RightTop, i * TILESIZE, j * TILESIZE); break; //LEFT 1 case 9: batch.draw(house1Left1, i * TILESIZE, j * TILESIZE); break; // LEFT 2 case 10: batch.draw(house1Left2, i * TILESIZE, j * TILESIZE); break; // Left 3 case 11: batch.draw(house1Left3, i * TILESIZE, j * TILESIZE); break; //Left 4 case 12: batch.draw(house1Left4, i * TILESIZE, j * TILESIZE); break; //LeftTop case 13: batch.draw(house1LeftTop, i * TILESIZE, j * TILESIZE); break; //Right 1 case 14: batch.draw(house1Right1, i * TILESIZE, j * TILESIZE); break; //Right 2 case 15: batch.draw(house1Right2, i * TILESIZE, j * TILESIZE); break; //Right 3 case 16: batch.draw(house1Right3, i * TILESIZE, j * TILESIZE); break; //Right 4 case 17: batch.draw(house1Right4, i * TILESIZE, j * TILESIZE); break; //Right Top case 18: batch.draw(house1RightTop, i * TILESIZE, j * TILESIZE); break; //Smoke Stack case 19: batch.draw(house1SmokeStack, i * TILESIZE, j * TILESIZE); break; //Top1 case 20: batch.draw(house1Top1, i * TILESIZE, j * TILESIZE); break; //Top2 case 21: batch.draw(house1Top2, i * TILESIZE, j * TILESIZE); break; //Wall1 case 22: batch.draw(house1Wall1, i * TILESIZE, j * TILESIZE); break; //Wall2 case 23: batch.draw(house1Wall2, i * TILESIZE, j * TILESIZE); break; //Wall3 case 24: batch.draw(house1Wall3, i * TILESIZE, j * TILESIZE); break; //Window2 Left Bottom case 25: batch.draw(house1Window2LeftBottom, i * TILESIZE, j * TILESIZE); break; //Window2 Left Top case 26: batch.draw(house1Window2LeftTop, i * TILESIZE, j * TILESIZE); break; //Window2 Right Bottom case 27: batch.draw(house1Window2RightBottom, i * TILESIZE, j * TILESIZE); break; //Window2 Right Top case 28: batch.draw(house1Window2RightTop, i * TILESIZE, j * TILESIZE); break; //Window1 Left Bottom case 29: batch.draw(house1WindowLeftBottom, i * TILESIZE, j * TILESIZE); break; //Window1 Left Top case 30: batch.draw(house1WindowLeftTop, i * TILESIZE, j * TILESIZE); break; //Window1 Right Bottom case 31: batch.draw(house1WindowRightBottom, i * TILESIZE, j * TILESIZE); break; //Window1 Right Top case 32: batch.draw(house1WindowRightTop, i * TILESIZE, j * TILESIZE); break; //Spikes1 case 33: batch.draw(Spikes1, i * TILESIZE, j * TILESIZE); break; } } } }
From source file:com.anhld.game.WorldRenderer.java
License:Apache License
private void renderWorld(SpriteBatch batch) { worldController.cameraHelper.applyTo(camera); camera.update();//from w w w . j a v a 2s . co m batch.setProjectionMatrix(camera.combined); batch.begin(); if (Stores.getInstance().getObjectStores().get(Constants.BACKGROUND) != null) { batch.draw(Stores.getInstance().getObjectStores().get(Constants.BACKGROUND), -Stores.getInstance().getObjectStores().get(Constants.BACKGROUND).getRegionWidth() * 0.5f, -Stores.getInstance().getObjectStores().get(Constants.BACKGROUND).getRegionHeight() * 0.5f); } if (Stores.getInstance().getObjectStores().get(Constants.SHADOWN) != null) { Stores.getInstance().getObjectStores().get(Constants.SHADOWN) .setRegionWidth((int) virtualViewport.getVirtualWidth()); batch.draw(Stores.getInstance().getObjectStores().get(Constants.SHADOWN), -virtualViewport.getVirtualWidth() / 2, virtualViewport.getVirtualHeight() / 2 - Stores.getInstance().getObjectStores().get(Constants.SHADOWN).getRegionHeight()); } if (Stores.getInstance().getObjectStores().get(Constants.SCORE) != null) batch.draw(Stores.getInstance().getObjectStores().get(Constants.SCORE), -50, virtualViewport.getVirtualHeight() / 2 - Stores.getInstance().getObjectStores().get(Constants.SCORE).getRegionHeight() - 10); worldController.gameLogic.render(batch); batch.end(); }