private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.point(point.x, point.y, 0); }
@Override public void drawContactPoint (Vector3 pointOnB, Vector3 normalOnB, float distance, int lifeTime, Vector3 color) { shapeRenderer.setColor(color.x, color.y, color.z, 1f); shapeRenderer.point(pointOnB.x, pointOnB.y, pointOnB.z); shapeRenderer.line(pointOnB, normalOnB.scl(distance).add(pointOnB)); }
@Override public void drawContactPoint (Vector3 pointOnB, Vector3 normalOnB, float distance, int lifeTime, Vector3 color) { shapeRenderer.setColor(color.x, color.y, color.z, 1f); shapeRenderer.point(pointOnB.x, pointOnB.y, pointOnB.z); shapeRenderer.line(pointOnB, normalOnB.scl(distance).add(pointOnB)); }
private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.setColor(getColorByBody(contact.getFixtureA().getBody())); renderer.point(point.x, point.y, 0); }
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(); }
for (int i = 0; i < len; i++) { Group group = (Group)actors.get(i); renderer.point(group.getX() + group.getOriginX(), group.getY() + group.getOriginY(), 0);
for (int j = 0; j < numContactPoints; j++) { Vector2 point = manifold.getPoints()[j]; renderer.point(point.x, point.y, 0);
renderer.point(MathUtils.random(0.0f, 1.0f), MathUtils.random(0.0f, 1.0f), 0);
@Override public void drawContactPoint (Vector3 pointOnB, Vector3 normalOnB, float distance, int lifeTime, Vector3 color) { shapeRenderer.setColor(color.x, color.y, color.z, 1f); shapeRenderer.point(pointOnB.x, pointOnB.y, pointOnB.z); shapeRenderer.line(pointOnB, normalOnB.scl(distance).add(pointOnB)); }
@Override public void putPixel(int x, int y) { endBatch(); shapeRenderer.begin(ShapeRenderer.ShapeType.Point); shapeRenderer.setColor(currentColor); shapeRenderer.point(x, height - y, 0); shapeRenderer.end(); }
@Override public void render () { // Wanna see what happens when we accidentally generate the stars every frame? // initStars(STAR_DENSITY); // TODO: Make the night sky black Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // TODO: Begin a shapeRenderer batch using ShapeType.Point shapeRenderer.begin(ShapeType.Point); // TODO: Loop through the star positions and use shapeRenderer to draw points for (Vector2 star : stars){ shapeRenderer.point(star.x, star.y, 0); } // TODO: End the shapeRenderer batch shapeRenderer.end(); }
/** * Render is where the action happens. By default, render will get called 60 times a second, and * it's the cue that it's time for our game to update itself and draw a new frame. */ @Override public void render() { // Set the background color to opaque black Gdx.gl.glClearColor(0, 0, 0, 1); // Actually tell OpenGL to clear the screen Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // First we begin a batch of points shapeRenderer.begin(ShapeType.Point); // Then we draw a point shapeRenderer.point(100, 100, 0); // And make sure we end the batch shapeRenderer.end(); }
@Override public void render(float delta) { Engine.getShapeRenderer().begin(ShapeType.Point); Engine.getShapeRenderer().setColor(Color.YELLOW); for (int x = 0; x < width; x++) { float blend = 1 - Math.abs(width / 2 - x) / (float) width / 2f; blend = (float) Math.pow(blend, 3); float y = MathUtils.cosDeg(x / (float) width * 360 * 2 * 5 + _myPhase) * _myAmplitude * blend; Engine.getShapeRenderer().point(x, y + Engine.getHeight() / 2, 0); } Engine.getShapeRenderer().end(); }
private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.setColor(getColorByBody(contact.getFixtureA().getBody())); renderer.point(point.x, point.y, 0); }
/** * Draws a dotted line between to points (x1,y1) and (x2,y2). * @param shapeRenderer * @param dotDist (distance between dots) * @param x1 * @param y1 * @param x2 * @param y2 */ private void drawDottedLine(ShapeRenderer shapeRenderer, int dotDist, float x1, float y1, float x2, float y2) { shapeRenderer.begin(ShapeType.Point); Vector2 vec2 = new Vector2(x2, y2).sub(new Vector2(x1, y1)); float length = vec2.len(); for(int i = 0; i < length; i += dotDist) { vec2.clamp(length - i, length - i); shapeRenderer.point(x1 + vec2.x, y1 + vec2.y, 0); } shapeRenderer.end(); }
for(int x = (int) getOffset(start.x); x < getOffset(end.x) + tilesize; x += tilesize) { for(int y = (int) getOffset(start.y); y > getOffset(end.y); y -= tilesize) { sr.point(x, y, 0);