/** Begins a new batch without specifying a shape type. * @throws IllegalStateException if {@link #autoShapeType} is false. */ public void begin () { if (!autoShapeType) throw new IllegalStateException("autoShapeType must be true to use this method."); begin(ShapeType.Line); }
/** Begins a new batch without specifying a shape type. * @throws IllegalStateException if {@link #autoShapeType} is false. */ public void begin () { if (!autoShapeType) throw new IllegalStateException("autoShapeType must be true to use this method."); begin(ShapeType.Line); }
public void set (ShapeType type) { if (shapeType == type) return; if (shapeType == null) throw new IllegalStateException("begin must be called first."); if (!autoShapeType) throw new IllegalStateException("autoShapeType must be enabled."); end(); begin(type); }
/** Use this in case no {@code glViewport} is in use. Otherwise please supply the used {@link Viewport} to * {@link #begin(Viewport)}. * @param camera The (perspective) camera to be used when doing the debug rendering. */ public void begin (Camera camera) { this.camera = camera; shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Line); }
public void flush () { ShapeType type = shapeType; end(); begin(type); }
public void flush () { ShapeType type = shapeType; end(); begin(type); }
/** Use this in case no {@code glViewport} is in use. Otherwise please supply the used {@link Viewport} to * {@link #begin(Viewport)}. * @param camera The (perspective) camera to be used when doing the debug rendering. */ public void begin (Camera camera) { this.camera = camera; shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Line); }
public void set (ShapeType type) { if (shapeType == type) return; if (shapeType == null) throw new IllegalStateException("begin must be called first."); if (!autoShapeType) throw new IllegalStateException("autoShapeType must be enabled."); end(); begin(type); }
private void renderBones () { renderer.begin(ShapeType.Line); renderer.setColor(0, 1, 0, 1); for (int i = 0; i < bones.length - 1; i++) { renderer.line(bones[i].position.x, bones[i].position.y, bones[i + 1].position.x, bones[i + 1].position.y); } renderer.end(); renderer.begin(ShapeType.Point); renderer.setColor(1, 0, 0, 1); for (int i = 0; i < bones.length; i++) { renderer.point(bones[i].position.x, bones[i].position.y, 0); } renderer.end(); }
private void renderGrid (ShapeRenderer shapeRenderer, int minX, int maxX, int minY, int maxY) { shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(this.lineColor); for (int i = minX; i <= maxX; i++) { shapeRenderer.line(i, minY, i, maxY); } for (int i = minY; i <= maxY; i++) { shapeRenderer.line(minX, i, maxX, i); } shapeRenderer.end(); }
public void drawLine (float x1, float y1, float x2, float y2) { renderer.setProjectionMatrix(batch.getProjectionMatrix()); renderer.begin(ShapeType.Line); renderer.line(x1, y1, x2, y2); renderer.end(); }
private void renderGrid (ShapeRenderer shapeRenderer, int minX, int maxX, int minY, int maxY) { shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(this.lineColor); for (int i = minX; i <= maxX; i++) { shapeRenderer.line(i, minY, i, maxY); } for (int i = minY; i <= maxY; i++) { shapeRenderer.line(minX, i, maxX, i); } shapeRenderer.end(); }
private void renderBox (Body body, float halfWidth, float halfHeight) { // get the bodies center and angle in world coordinates Vector2 pos = body.getWorldCenter(); float angle = body.getAngle(); // set the translation and rotation matrix transform.setToTranslation(pos.x, pos.y, 0); transform.rotate(0, 0, 1, (float)Math.toDegrees(angle)); // render the box renderer.begin(ShapeType.Line); renderer.setTransformMatrix(transform); renderer.setColor(1, 1, 1, 1); renderer.rect(-halfWidth, -halfHeight, halfWidth * 2, halfHeight * 2); renderer.end(); }
public void renderSkeleton (final ModelInstance instance) { shapeRenderer.setProjectionMatrix(cam.combined); shapeRenderer.begin(ShapeType.Line); for (Node node : instance.nodes) { shapeRenderer.setColor(node.isAnimated ? Color.RED : Color.YELLOW); node.globalTransform.getTranslation(tmpV); shapeRenderer.box(tmpV.x, tmpV.y, tmpV.z, 0.5f, 0.5f, 0.5f); for (Node child : node.getChildren()) renderSkeleton(tmpV, child); } shapeRenderer.end(); }
public void render () { time += Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.begin(ShapeType.Line); renderer.rect(10, 10, 256, 256); renderer.end(); batch.begin(); // badlogic.draw(batch); // star.draw(batch); // font.draw(batch, "This font was packed!", 26, 65); badlogicSmall.draw(batch); // batch.draw(jumpAnimation.getKeyFrame(time, true), 100, 100); batch.end(); }
private void renderOclDebugImage () { TextureRegion oclDebugTexture = oclBuffer.drawDebugTexture(); spriteBatch.begin(); spriteBatch.draw(oclDebugTexture, 0, 0); spriteBatch.end(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(Color.DARK_GRAY); shapeRenderer.rect(0, 0, oclDebugTexture.getRegionWidth(), oclDebugTexture.getRegionHeight()); shapeRenderer.end(); }
@Override public void render () { super.render(); Gdx.gl.glLineWidth(5); shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(1, 0, 0, 1f); shapeRenderer.line(selectedTriangleVertices[0], selectedTriangleVertices[1]); shapeRenderer.line(selectedTriangleVertices[1], selectedTriangleVertices[2]); shapeRenderer.line(selectedTriangleVertices[2], selectedTriangleVertices[0]); shapeRenderer.end(); Gdx.gl.glLineWidth(1); }
@Override public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); int size = Math.min(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); int quarterSize = (int) (size/4f); batch.begin(); batch.draw(textureRegions.get(pageToShow), 0, 0, size, size); ninePatch.draw(batch, 10, 10, quarterSize, quarterSize); officialPatch.draw(batch, (int)(size * 0.25f + 20), 10, quarterSize, quarterSize); batch.end(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(Color.GREEN); shapeRenderer.rect(0, 0, size, size); shapeRenderer.end(); }
@Override public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.begin(ShapeType.Line); renderer.setColor(1, 1, 1, 1); renderer.line(0, 100, Gdx.graphics.getWidth(), 100); renderer.line(100, 0, 100, Gdx.graphics.getHeight()); renderer.end(); batch.begin(); batch.draw(region, 100, 100, 0, 0, 32, 32, 2, 2, 20); batch.end(); }
@Override public void render () { Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); renderer.setProjectionMatrix(camera.combined); renderer.begin(ShapeType.Filled); int size = Math.max(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()) / 10; for (int i = 0; i < 10; i++) { if (!Gdx.input.isTouched(i)) continue; viewport.unproject(tp.set(Gdx.input.getX(i), Gdx.input.getY(i))); Color color = colors[i % colors.length]; renderer.setColor(color); float sSize = size * Gdx.input.getPressure(i); renderer.triangle(tp.x, tp.y + sSize, tp.x + sSize, tp.y - sSize, tp.x - sSize, tp.y - sSize); } renderer.end(); }