Skip to content

Commit

Permalink
Update VideoActor to set the batch color before drawing the video tex…
Browse files Browse the repository at this point in the history
…ture (#91)

* Update VideoActor to set the batch color before drawing the video texture

Setting the batch color before drawing the video texture prevents other actors in the stage that modifies the batch color from tinting the video texture.

* Add missing import.

* Actually fix the Color import.
  • Loading branch information
lucas-kakele authored May 20, 2024
1 parent dcd0a6a commit 74487b0
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.badlogic.gdx.video.scenes.scene2d;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.Actor;
Expand Down Expand Up @@ -49,6 +50,8 @@ public void act (float delta) {
public void draw (Batch batch, float parentAlpha) {
Texture texture = player.getTexture();
if (texture == null) return;
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
batch.draw(texture, getX(), getY(), getWidth(), getHeight(), 0, 0, player.getVideoWidth(), player.getVideoHeight(), false,
false);
}
Expand Down

0 comments on commit 74487b0

Please sign in to comment.