private void setup2D() { orthoCamera.update(); graphics.setProjectionMatrix(orthoCamera.combined); // Not needed //viewport.apply(); }
private void arc(float x, float y, float radius, float start, float degrees, ShapeRenderer.ShapeType shapeType) { arc(x, y, radius, start, degrees, Math.max(1, (int) (6 * (float) Math.cbrt(radius) * (degrees / 360.0f))), shapeType); }
public void drawString(String text, int x, int y) { beginBatch(); drawFont(text, x, y - font.getFont().getCapHeight()); }
public void setBatchColor(int color) { setBatchColor(buildColor(color)); }
public void setColor(int color) { setColor(buildColor(color)); }
public void setOpacity(int opacity) { endBatch(); if (!alphaEnabled) { alphaEnabled = true; } beginBatch(); this.alpha = opacity; currentColor.a = this.alpha / (float) Layer.MAX_OPACITY; batch.setColor(1, 1, 1, currentColor.a); }
protected void init() { graphics = new GDXGraphics(w, h); graphics.setOrthographicCamera(orthoCamera); graphics.setProjectionMatrix(orthoCamera.combined); // Set default font FontLoader.getInstance().loadDefaultFont(); graphics.setFont(FontLoader.getInstance().defaultFont()); // Override Back Button Behavior // Without this, dispose and reload does not work well Gdx.input.setCatchBackKey(true); Gdx.input.setInputProcessor(this); initModules(); }
@Override public void fillArc(int x, int y, int w, int h, int startAngle, int arcAngle) { int radius = w / 2 + 1; int cx = x + radius; int cy = height - y - h / 2 - 1; endBatch(); shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); shapeRenderer.setColor(currentColor); arc(cx, cy, radius, startAngle, arcAngle, ShapeRenderer.ShapeType.Filled); shapeRenderer.end(); }
@Override public void render() { createFirstApplication(); long now = System.currentTimeMillis(); update(now); updateLoading(loadContext); renderContext(context); drawModules(graphics); graphics.flush(); }
public void drawString(String text, GeometricLayer layer, int offsetX, int offsetY) { drawString(text, layer.getX() + offsetX, layer.getY() + offsetY, layer.getW(), layer.getH()); }
public void drawCircle(int cx, int cy, int radius) { drawOval(cx - radius, cy - radius, radius * 2, radius * 2); }
@Override public SpriteBatch getBatch() { return beginBatch(); }
public void setFontColor(int color) { font.getFont().setColor(buildColor(color)); }
public void drawRect(GeometricLayer layer) { drawRect(layer.getX(), layer.getY(), layer.getW(), layer.getH()); }
@Override public void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle) { int radius = w / 2 + 1; int cx = x + radius; int cy = height - y - h / 2 - 1; endBatch(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(currentColor); arc(cx, cy, radius, startAngle, arcAngle, ShapeRenderer.ShapeType.Line); shapeRenderer.end(); }
@Override public void render() { createFirstApplication(); long now = System.currentTimeMillis(); update(now); updateLoading(loadContext); renderContext(context); drawModules(graphics); //spriteBatch.end() if needed graphics.flush(); }
public void drawString(String text, GeometricLayer layer) { drawString(text, layer.getX(), layer.getY(), layer.getW(), layer.getH()); }
public void drawOval(GeometricLayer layer) { drawOval(layer.getX(), layer.getY(), layer.getW(), layer.getH()); }
public void resize(int width, int height) { viewport.update(width, height); orthoCamera.position.set(orthoCamera.viewportWidth / 2, orthoCamera.viewportHeight / 2, 0); graphics.setProjectionMatrix(orthoCamera.combined); }
public void drawString(String text, int x, int y, int w, int h) { beginBatch(); GlyphLayout layout = new GlyphLayout(); layout.setText(font.getFont(), text); float cx = w / 2 - layout.width / 2; float cy = h / 2 - layout.height / 2; drawFont(text, x + cx, y + cy); }