renderer.setProjectionMatrix(axisViewport.getCamera().combined);
renderer.setProjectionMatrix(axisViewport.getCamera().combined); renderer.begin(ShapeType.Filled); renderer.setColor(AXIS_COLOR);
@Override public void render() { viewport.apply(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.setProjectionMatrix(viewport.getCamera().combined); renderer.begin(ShapeType.Filled); float elapsedNanoseconds = TimeUtils.nanoTime() - initialTime; float elapsedSeconds = MathUtils.nanoToSec * elapsedNanoseconds; float elapsedPeriods = elapsedSeconds / PERIOD; float cyclePosition = elapsedPeriods % 1; float x = WORLD_SIZE / 2 + MOVEMENT_RADIUS * MathUtils.cos(MathUtils.PI2 * cyclePosition); float y = WORLD_SIZE / 2 + MOVEMENT_RADIUS * MathUtils.sin(MathUtils.PI2 * cyclePosition); renderer.circle(x, y, CIRCLE_RADIUS); // Uncomment the next line to see the sort of beautiful things you can create with simple movement // drawFancyCircles(renderer, elapsedPeriods, 20); renderer.end(); }
@Override public void render() { viewport.apply(); Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); // TODO: Draw the platform texture at TEST_SIZE_1 batch.draw(platformTexture, WORLD_SIZE * 1 / 4 - TEST_SIZE_1 / 2, WORLD_SIZE * 1 / 4 - TEST_SIZE_1 / 2, TEST_SIZE_1, TEST_SIZE_1); // TODO: Draw the platform texture at TEST_SIZE_2 batch.draw(platformTexture, WORLD_SIZE * 3 / 4 - TEST_SIZE_2 / 2, WORLD_SIZE * 1 / 4 - TEST_SIZE_2 / 2, TEST_SIZE_2, TEST_SIZE_2); // TODO: Draw the nine patch at TEST_SIZE_1 platformNinePatch.draw(batch, WORLD_SIZE * 1 / 4 - TEST_SIZE_1 / 2, WORLD_SIZE * 3 / 4 - TEST_SIZE_1 / 2, TEST_SIZE_1, TEST_SIZE_1); // TODO: Draw the nine patch at TEST_SIZE_2 platformNinePatch.draw(batch, WORLD_SIZE * 3 / 4 - TEST_SIZE_2 / 2, WORLD_SIZE * 3 / 4 - TEST_SIZE_2 / 2, TEST_SIZE_2, TEST_SIZE_2); batch.end(); }
@Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewport.apply(); renderer.setProjectionMatrix(viewport.getCamera().combined); renderer.begin(ShapeType.Filled); renderer.setColor(Color.RED); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 0); renderer.setColor(Color.GREEN); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 120); renderer.setColor(Color.BLUE); renderer.rect(2, 3.5f, 3, 1.5f, 6, 1, 1, 1, 240); // TODO: Make it look like the left end of RED is on top of BLUE renderer.setColor(Color.RED); renderer.rect(2, 3.5f, 3, 1.5f, 3, 1, 1, 1, 0); renderer.end(); } }
@Override public void render(float delta) { float elapsedTime = MathUtils.nanoToSec * TimeUtils.timeSinceNanos(startTime); viewport.apply(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); shapeRenderer.setProjectionMatrix(viewport.getCamera().combined); shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(1, 1, 1, 1); for (Rectangle rectangle : rectangles) { shapeRenderer.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height); } for (OscillatingCircle oscillatingCircle : circles) { Circle circle = oscillatingCircle.getCurrentCircle(elapsedTime); boolean colliding = false; for (Rectangle rectangle : rectangles) { if (areColliding(rectangle, circle)) { colliding = true; break; } } if (colliding) { shapeRenderer.setColor(1, 0, 0, 1); } else { shapeRenderer.setColor(0, 1, 0, 1); } shapeRenderer.circle(circle.x, circle.y, circle.radius, circleSegments); } shapeRenderer.end(); }