Java Code Examples for com.badlogic.gdx.graphics.g2d.SpriteBatch#disableBlending()

The following examples show how to use com.badlogic.gdx.graphics.g2d.SpriteBatch#disableBlending() . 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: DebugHelper.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
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 2
Source File: GameRenderer.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public void debugRender () {
	if (debug) {
		SpriteBatch batch = batchRenderer.beginTopLeft();

		batch.setTransformMatrix(xform);
		batch.disableBlending();
		GameEvents.gameRenderer.batch = batch;
		GameEvents.gameRenderer.trigger(this, GameRendererEvent.Type.BatchDebug);
		batchRenderer.end();

		batch.setTransformMatrix(identity);
		GameEvents.gameRenderer.batch = null;
		GameEvents.gameRenderer.trigger(this, GameRendererEvent.Type.Debug);
	}
}
 
Example 3
Source File: LightShafts.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private void debug (SpriteBatch batch) {
	Gdx.gl.glDisable(GL20.GL_BLEND);
	Gdx.gl.glDisable(GL20.GL_CULL_FACE);
	Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
	batch.disableBlending();
	dbgTextureW(batch, 360, occlusionMap.getResultTexture(), 50);
}
 
Example 4
Source File: Ssao.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private void debug (SpriteBatch batch) {
	Gdx.gl.glDisable(GL20.GL_BLEND);
	Gdx.gl.glDisable(GL20.GL_CULL_FACE);
	Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
	batch.disableBlending();

	dbgTextureW(batch, 180, normalDepthMap, 12);
	dbgTextureW(batch, 360, occlusionMap.getResultTexture(), 24);
}
 
Example 5
Source File: Scene.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
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 6
Source File: MatrixSpellerScreen.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Override
    public void draw(){

    // Clear screen.
    Gdx.gl.glClearColor(0,0,0,0);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    SpriteBatch batch = new SpriteBatch();
    batch.begin();

    batch.disableBlending();
    int si=0;
    for (int x = 0; x < symbols.length; x++) {
        for (int y = 0; y < symbols[0].length; y++) {
            if( si< _ss.length ){
                if( _ss[si] <= 0 ){ // background
                    bgGrid[x][y].draw(batch);
                } else if ( _ss[si] == 1 ){ // foreground
                    fgGrid[x][y].draw(batch);
                } else if ( _ss[si] == 2 ){ // target
                    tgtGrid[x][y].draw(batch);
                } else if ( _ss[si] == 3 ){ // feedback
                    fbGrid[x][y].draw(batch);
                }
            } else { // if not given then set to BG
                bgGrid[x][y].draw(batch);
            }
            si++;
        }
    }
    batch.end();
}
 
Example 7
Source File: DebugCarEngineVolumes.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
@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 8
Source File: DebugMusicVolumes.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
@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();
	}
}