Java Code Examples for com.badlogic.gdx.graphics.g2d.SpriteBatch#enableBlending()
The following examples show how to use
com.badlogic.gdx.graphics.g2d.SpriteBatch#enableBlending() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScreenGameMap.java From RuinsOfRevenge with MIT License | 6 votes |
@Override public void draw(SpriteBatch batch) { if (bloom != Config.get().bloom) { processor = rebuildProcessor(); } processor.capture(); cam.loadToBatch(batch); map.renderBelowEntities(cam.getCam()); batch.enableBlending(); batch.begin(); client.draw(batch, map.getFringeLayer(), Gdx.graphics.getDeltaTime()); batch.end(); map.renderAboveEntities(cam.getCam()); processor.render(); if (debugDraw) debugRenderer.render(client.getPhysics().getWorld(), cam.getCam().combined); drawHUD(batch); }
Example 2
Source File: DebugHelper.java From uracer-kotd with Apache License 2.0 | 5 votes |
private void renderGraphicalStats (SpriteBatch batch, int y) { batch.enableBlending(); batch.setColor(1, 1, 1, 0.8f); batch.draw(stats.getRegion(), ScaleUtils.PlayWidth - stats.getWidth(), y); batch.setColor(1, 1, 1, 1f); batch.disableBlending(); }
Example 3
Source File: Scene.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public void draw(SpriteBatch batch) { if (background != null) { batch.disableBlending(); batch.setProjectionMatrix(camera.calculateParallaxMatrix(1, 1)); batch.begin(); float x = 0; for (AtlasRegion tile : background) { batch.draw(tile, x, 0f); x += tile.getRegionWidth(); } batch.end(); batch.enableBlending(); } // draw layers from bottom to top for (int i = layers.size() - 1; i >= 0; i--) { SceneLayer layer = layers.get(i); batch.setProjectionMatrix(camera.calculateParallaxMatrix(layer.getParallaxMultiplier(), 1)); batch.begin(); layer.draw(batch); batch.end(); } }
Example 4
Source File: DebugCarEngineVolumes.java From uracer-kotd with Apache License 2.0 | 4 votes |
@Override public void renderBatch (SpriteBatch batch) { if (isActive() && meters.size > 0) { Matrix4 prev = batch.getTransformMatrix(); batch.setTransformMatrix(idt); batch.enableBlending(); float prevHeight = 0; int index = 0; int drawx = 410; int drawy = 0; SpriteBatchUtils.drawString(batch, "car engine soundset", drawx, drawy); SpriteBatchUtils.drawString(batch, "=======================", drawx, drawy + Art.DebugFontHeight); String text; for (DebugMeter m : meters) { int x = drawx, y = drawy + Art.DebugFontHeight * 2; // offset by index y += index * (prevHeight + 1); // compute color float alpha = 1; Color c = ColorUtils.paletteRYG(1.5f - m.getValue() * 1.5f, alpha); { // render track number text = sampleNames[index]; batch.setColor(1, 1, 1, alpha); SpriteBatchUtils.drawString(batch, text, x, y); batch.setColor(1, 1, 1, 1); // render meter after text int meter_x = x + (text.length() * Art.DebugFontWidth) + 2; m.color.set(c); m.setPosition(meter_x, y); m.render(batch); // render volume numerical value text = String.format("%.02f", m.getValue()); batch.setColor(1, 1, 1, alpha); SpriteBatchUtils.drawString(batch, text, meter_x + m.getWidth() + 2, y); batch.setColor(1, 1, 1, 1); } index++; prevHeight = m.getHeight(); } batch.setTransformMatrix(prev); batch.disableBlending(); } }
Example 5
Source File: DebugMusicVolumes.java From uracer-kotd with Apache License 2.0 | 4 votes |
@Override public void renderBatch (SpriteBatch batch) { if (isActive() && meters.size > 0) { Matrix4 prev = batch.getTransformMatrix(); batch.setTransformMatrix(idt); batch.enableBlending(); float prevHeight = 0; int index = 0; int drawx = 275; int drawy = 0; int maxMusicIndex = tensiveMusic.getCurrentMusicIndexLimit(); SpriteBatchUtils.drawString(batch, "music tracks max=" + maxMusicIndex, drawx, drawy); SpriteBatchUtils.drawString(batch, "==================", drawx, drawy + Art.DebugFontHeight); String text; for (DebugMeter m : meters) { int x = drawx, y = drawy + Art.DebugFontHeight * 2; // offset by index y += index * (prevHeight + 1); // compute color float alpha = index > maxMusicIndex ? 0.5f : 1; Color c = ColorUtils.paletteRYG(1.5f - m.getValue() * 1.5f, alpha); { // render track number text = "T" + (index + 1); batch.setColor(1, 1, 1, alpha); SpriteBatchUtils.drawString(batch, text, x, y); batch.setColor(1, 1, 1, 1); // render meter after text int meter_x = x + (text.length() * Art.DebugFontWidth) + 2; m.color.set(c); m.setPosition(meter_x, y); m.render(batch); // render volume numerical value text = String.format("%.02f", m.getValue()); batch.setColor(1, 1, 1, alpha); SpriteBatchUtils.drawString(batch, text, meter_x + m.getWidth() + 2, y); batch.setColor(1, 1, 1, 1); } index++; prevHeight = m.getHeight(); } SpriteBatchUtils.drawString(batch, "total volume = " + String.format("%.02f", totalVolume), drawx, Art.DebugFontHeight * (meters.size + 3)); batch.setTransformMatrix(prev); batch.disableBlending(); } }