for (int i = 0; i < len; i++) { Group group = (Group)actors.get(i); renderer.point(group.getX() + group.getOriginX(), group.getY() + group.getOriginY(), 0);
protected Matrix4 computeTransform() { Affine2 worldTransform = this.worldTransform; Group root = getRoot(); worldTransform.setToTrnRotScl(root.getX(), root.getY(), 0, root.getScaleX(), root.getScaleY()); computedTransform.set(worldTransform); return computedTransform; } }
@Override public float[] getPositionAndSizeGui(String name) { IGui gui = GaiaSky.instance.mainGui; Actor actor = gui.getGuiStage().getRoot().findActor(name); if (actor != null) { float x = actor.getX(); float y = actor.getY(); // x and y relative to parent, so we need to add coordinates of // parents up to top Group parent = actor.getParent(); while (parent != null) { x += parent.getX(); y += parent.getY(); parent = parent.getParent(); } return new float[] { x, y, actor.getWidth(), actor.getHeight() }; } else { return null; } }
@Override public void draw(Batch batch, float parentAlpha) { // TODO This is not the best way to apply the transformation, but, oh well float x = getParent().getX(); float y = getParent().getY(); // TODO For some strange reason, the texture coordinates and label coordinates are different Vector2 pos = localToStageCoordinates(new Vector2(x, y)); batch.setColor(Klooni.theme.bandColor); batch.draw(bandTexture, pos.x, pos.y, getWidth(), getHeight()); scoreLabel.setBounds(x + scoreBounds.x, y + scoreBounds.y, scoreBounds.width, scoreBounds.height); scoreLabel.setText(Integer.toString(scorer.getCurrentScore())); scoreLabel.setColor(Klooni.theme.textColor); scoreLabel.draw(batch, parentAlpha); infoLabel.setBounds(x + infoBounds.x, y + infoBounds.y, infoBounds.width, infoBounds.height); infoLabel.setColor(Klooni.theme.textColor); infoLabel.draw(batch, parentAlpha); }
@Override public void draw(Batch batch, float parentAlpha) { batch.flush(); clipBegin(); super.draw(batch, parentAlpha); clipEnd(); if (this.drawDebug) { batch.end(); debugRenderer.setProjectionMatrix(batch.getProjectionMatrix()); debugRenderer.begin(ShapeRenderer.ShapeType.Line); debugRenderer.rect(getX() + getParent().getX(), getY() + getParent().getY(), getWidth(), getHeight()); debugRenderer.setColor(Color.YELLOW); debugRenderer.end(); batch.begin(); } }