List of usage examples for com.badlogic.gdx.graphics.g2d Sprite draw
public void draw(Batch batch, float alphaModulation)
From source file:br.cefetmg.games.screens.TransitionEffect.java
public void fadeOut(Batch batch, Sprite sprite) { alpha = timeFunction(x); sprite.draw(batch, Math.max(Math.min(alpha, 1), 0)); }
From source file:br.cefetmg.games.screens.TransitionEffect.java
public void fadeIn(Batch batch, Sprite sprite) { sprite.draw(batch, Math.max(Math.min(1 - alpha, 1), 0)); alpha = timeFunction(x); }
From source file:CB_Locator.Map.ZoomScale.java
License:Open Source License
@Override protected void render(Batch batch) { if (this.getWidth() < 1 || this.getHeight() < 1) return;/*from ww w . j a v a 2s. co m*/ int valueRecHeight = (int) (this.getWidth() / 2); if (ScaleDrawRec == null) { ScaleDrawRec = this.copy(); ScaleDrawRec.setHeight(this.getHeight() - valueRecHeight); ScaleDrawRec.setPos(new Vector2(0, valueRecHeight / 2)); } if (!isVisible) return; checkFade(); // Draw Scale Sprite scale = drawSprite(ScaleDrawRec); if (scale != null) { scale.setY(valueRecHeight / 2); scale.draw(batch, FadeValue); } // Draw Value Background if (ValueRec != null) { Sprite valueBack; valueBack = Sprites.ZoomValueBack; valueBack.setBounds(ValueRec.getX() + 1.5f, ValueRec.getY(), ValueRec.getWidth(), ValueRec.getHeight()); valueBack.draw(batch, FadeValue); } int intZoom = (int) zoom; try { com.badlogic.gdx.graphics.Color c = COLOR.getFontColor(); Fonts.getNormal().setColor(c.r, c.g, c.b, FadeValue); Fonts.getNormal().draw(batch, String.valueOf(intZoom), ValueRec.getX() + (ValueRec.getWidth() / 3), ValueRec.getY() + ValueRec.getHeight() / 1.15f); Fonts.getNormal().setColor(c.r, c.g, c.b, 1f); } catch (Exception e) { e.printStackTrace(); } invalidateTextureEventList.Add(this); }
From source file:CB_UI_Base.GL_UI.Controls.ZoomButtons.java
License:Open Source License
@Override public void render(Batch batch) { if (withoutDrawing) return;//ww w. jav a2 s . c o m super.render(batch); if (firstDraw) { resetFadeOut(); firstDraw = false; } if (!this.isVisible()) return; // Log.d("CACHEBOX", "in=" + fadeIn + " out=" + fadeOut + " Fade=" + FadeValue); checkFade(); // draw down button Sprite btnDown; if (zoom == minzoom) { btnDown = Sprites.ZoomBtn.get(2);// disabled } else { btnDown = Sprites.ZoomBtn.get(onTouchDown ? 1 : 0); } float hw = HitRecDown.getWidth(); float hh = HitRecDown.getHeight(); float hx = HitRecDown.getX(); float hy = HitRecDown.getY(); float offX = 0; float offY = 0; if (portrait) { float e = btnDown.getWidth() / 2; float f = btnDown.getHeight() / 2; btnDown.setOrigin(e, f); btnDown.setRotation(90); hw = hh; hh = HitRecDown.getWidth(); // caclc offset offX = -(e - f); offY = -(f - e); } else { btnDown.setRotation(0f); } btnDown.setBounds(hx + offX, hy + offY, hw, hh); btnDown.draw(batch, FadeValue); // draw up button Sprite btnUp; if (zoom == maxzoom) { btnUp = Sprites.ZoomBtn.get(5);// disabled } else { btnUp = Sprites.ZoomBtn.get(onTouchUp ? 4 : 3); } hw = HitRecUp.getWidth(); hh = HitRecUp.getHeight(); hx = HitRecUp.getX(); hy = HitRecUp.getY(); if (portrait) { float e = btnUp.getWidth() / 2; float f = btnUp.getHeight() / 2; btnUp.setOrigin(e, f); btnUp.setRotation(90); hw = hh; hh = HitRecUp.getWidth(); } else { btnUp.setRotation(0f); } btnUp.setBounds(hx + offX, hy + offY, hw, hh); btnUp.draw(batch, FadeValue); }
From source file:com.gmail.emersonmx.tictactoe.SpritesActor.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { if (index != HIDDEN) { Sprite sprite = sprites.get(index); if (sprite != null) { sprite.draw(batch, parentAlpha); }/*from ww w. j a v a 2s.c o m*/ } }
From source file:com.strategames.engine.gameobject.types.ChalkLine.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { // Gdx.app.log("ChalkLine", "draw: getColor().a="+getColor().a); if (this.steps > 0) { //add chalk points for (int i = 0; i < this.lengthPerStep; i += this.stepSize) { this.chalkLine.add(chalks[this.randomNumberGenerator.nextInt(5)]); }//from w ww . j a v a 2 s. co m this.steps--; } else if (this.steps == 0) { if (this.listener != null) { this.listener.onLineDrawEnd(this); } this.steps--; } int lineSize = this.chalkLine.size(); float x = this.start.x; float y = this.start.y; for (int i = 0; i < lineSize; i++) { Sprite sprite = this.chalkLine.get(i); sprite.setPosition(x, y); sprite.draw(batch, getColor().a); x += this.increments.x; y += this.increments.y; } }
From source file:com.strategames.engine.gameobject.types.Icecube.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { float x = getX(); float y = getY(); float rotation = getRotation(); for (int i = 0; i < this.amountOfParts; i++) { Part part = this.parts.get(i); Sprite sprite = part.getSprite(); sprite.setPosition(x, y);//from w w w . j a va2s . co m sprite.setRotation(rotation); sprite.draw(batch, parentAlpha); } if (this.breakOfPart != null) { Icecube icecube1 = new Icecube(); Icecube icecube2 = new Icecube(); splitObject(this.breakOfPart, icecube1, icecube2); GameEngine game = getGame(); Stage stage = getStage(); game.addGameObject(icecube1, stage); game.addGameObject(icecube2, stage); } // drawBoundingBox(batch); }
From source file:presentation.concretion.game.UIGameLoop.java
License:Open Source License
@Override public void renderItems(float posItemX, float posItemY, float widthItem, float heightItem, ItemType type) { // Draw item//from w ww. j a v a 2s .c om batch.begin(); Sprite item = characters.loadAnimationItems(type); item.setBounds(posItemX - widthItem / 2, posItemY - heightItem / 2, widthItem, heightItem); item.draw(batch, 10); batch.end(); }