Java Code Examples for com.badlogic.gdx.scenes.scene2d.Actor#draw()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.Actor#draw() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameStage.java    From GdxDemo3D with Apache License 2.0 6 votes vote down vote up
@Override
public void draw() {
	batch.begin();
	for (Actor actor : getActors()) {
		if (actor.isVisible()) {
			actor.draw(batch, 1);
		}
	}
	batch.end();

	if (DebugViewSettings.drawUIDebug) {
		shapeRenderer.begin();
		rootTable.drawDebug(shapeRenderer);
		shapeRenderer.end();
	}
	cameraController.update();
}
 
Example 2
Source File: MundusMultiSplitPane.java    From Mundus with Apache License 2.0 5 votes vote down vote up
@Override
public void draw(Batch batch, float parentAlpha) {
    validate();

    Color color = getColor();

    applyTransform(batch, computeTransform());

    SnapshotArray<Actor> actors = getChildren();
    for (int i = 0; i < actors.size; i++) {
        Actor actor = actors.get(i);
        Rectangle bounds = widgetBounds.get(i);
        Rectangle scissor = scissors.get(i);
        getStage().calculateScissors(bounds, scissor);
        if (ScissorStack.pushScissors(scissor)) {
            if (actor.isVisible()) actor.draw(batch, parentAlpha * color.a);
            batch.flush();
            ScissorStack.popScissors();
        }
    }

    batch.setColor(color.r, color.g, color.b, parentAlpha * color.a);

    Drawable handle = style.handle;
    Drawable handleOver = style.handle;
    if (isTouchable() && style.handleOver != null) handleOver = style.handleOver;
    for (Rectangle rect : handleBounds) {
        if (this.handleOver == rect) {
            handleOver.draw(batch, rect.x, rect.y, rect.width, rect.height);
        } else {
            handle.draw(batch, rect.x, rect.y, rect.width, rect.height);
        }
    }
    resetTransform(batch);
}
 
Example 3
Source File: MultiSplitPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public void draw (Batch batch, float parentAlpha) {
	validate();

	Color color = getColor();

	applyTransform(batch, computeTransform());

	SnapshotArray<Actor> actors = getChildren();
	for (int i = 0; i < actors.size; i++) {
		Actor actor = actors.get(i);
		Rectangle bounds = widgetBounds.get(i);
		Rectangle scissor = scissors.get(i);
		getStage().calculateScissors(bounds, scissor);
		if (ScissorStack.pushScissors(scissor)) {
			if (actor.isVisible()) actor.draw(batch, parentAlpha * color.a);
			batch.flush();
			ScissorStack.popScissors();
		}
	}

	batch.setColor(color.r, color.g, color.b, parentAlpha * color.a);

	Drawable handle = style.handle;
	Drawable handleOver = style.handle;
	if (isTouchable() && style.handleOver != null) handleOver = style.handleOver;
	for (Rectangle rect : handleBounds) {
		if (this.handleOver == rect) {
			handleOver.draw(batch, rect.x, rect.y, rect.width, rect.height);
		} else {
			handle.draw(batch, rect.x, rect.y, rect.width, rect.height);
		}
	}
	resetTransform(batch);
}