Libgdx window add alpha action change the background actor alpha
The window add Action Change background Alpha Actor
2023-09-27 14:22:25 时间
现象:
Stage中包括一个Window,一个Actor,Window中加入alpha action后,Actor也随之消失;Actor加入alpha action后,不起作用。
解决:
重写draw方法,加入batch.setColor(getColor().r, getColor().g, getColor().b, getColor().a);
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.scenes.scene2d.Actor; import com.secondegg.reversi.util.Assets; /** * * @author cuizhf */ public class Table extends Actor { public Table() { } @Override public void act (float delta) { super.act(delta); } @Override public void draw (Batch batch, float parentAlpha) { batch.setColor(getColor().r, getColor().g, getColor().b, getColor().a); batch.draw(Assets.instance.table.tableh, 0, 0); batch.draw(Assets.instance.table.tablen, 100, 0); } }
相关文章
- fatal: The upstream branch of your current branch does not match the name of your current branch
- Cookies are deleted when I close the browser?
- How to run a function when the page is loaded?
- No connection could be made because the target machine actively refused it [::1]:808
- git删除本地和远程文件,解决 fatal: Not a git repository (or any of the parent directories): .git 问题
- specify a file path to store the seed
- UVa 11077 Find the Permutations (计数DP)
- Kafka Replication: The case for MirrorMaker 2.0
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
- How to choose the number of topics/partitions in a Kafka cluster?
- Linux 图形界面的显示原理是什么?---the graphical server and the window manager
- 【HDU - 4344】Mark the Rope(大整数分解)
- what is the difference between definition and declaration in c
- provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.
- ParticleSfM:Exploiting Dense Point Trajectories for Localizing Moving Cameras in the Wild——论文笔记