Libgdx window add alpha action change the background actor alpha

现象:

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);
    }
}
时间: 2024-08-09 10:43:52

Libgdx window add alpha action change the background actor alpha的相关文章

[SVG] Add an SVG as a Background Image

Learn how to set an SVG as the background image of an element. Background images can be resized by changing the width and height of the element containing background image, so it’s easy to create multiple sizes of the same icon. However, each backgro

Window API译文

public abstract class Window extends Object java.lang.Object    ? android.view.Window Class Overview Abstract base class for a top-level window look and behavior policy. An instance of this class should be used as the top-level view added to the wind

Android设计和开发系列第二篇:Action Bar(Develop—Training)

Adding the Action Bar GET STARTED DEPENDENCIES AND PREREQUISITES Android 2.1 or higher YOU SHOULD ALSO READ Action Bar Implementing Effective Navigation DESIGN GUIDE Action Bar The action bar is one of the most important design elements you can imple

Android设计和开发系列第二篇:Action Bar(Develop—API Guides)

Action Bar IN THIS DOCUMENT Adding the Action Bar Removing the action bar Using a logo instead of an icon Adding Action Items Handling clicks on action items Using split action bar Navigating Up with the App Icon Adding an Action View Handling collap

libgdx自制简易Flappy Bird

Flappy Bird,好吧,无需多说.今天年初不知咋的,一下子就火了,而且直接跃居榜首,在ios和android平台都是如此,实在难以理解.传说其作者每天收入能达到5w刀,着实碉堡了... 好吧,咱没创意,不过山寨一个还是可以的,话说!!! 好了,不罗嗦了,直接代码了. 我使用libgdx框架(你要说是引擎也行)实现的,版本为0.9.9.就设计了一个开始画面和一个游戏画面. 游戏入口和主类: package com.fxb.flappy; import com.badlogic.gdx.Gam

浅谈C#中常见的委托<Func,Action,Predicate>(转)

http://www.cnblogs.com/JimmyZhang/archive/2007/09/23/903360.html 一提到委托,浮现在我们脑海中的大概是听的最多的就是类似C++的函数指针吧,呵呵,至少我的第一个反应是这样的. 关于委托的定义和使用,已经有诸多的人讲解过,并且讲解细致入微,尤其是张子阳的那一篇.我就不用多废话了. 今天我要说的是C#中的三种委托方式:Func委托,Action委托,Predicate委托以及这三种委托的常见使用场景. Func,Action,Predi

Libgdx1.5.1关于Action改动后的使用方式

API Change: Added concept of target actor, separate from the actor the action is added to. This allows an action to be added to one actor but affect another. This is useful to create a sequence of actions that affect many different actors. Previously

Android游戏框架Libgdx使用入门

转载自:http://blog.csdn.net/cping1982/article/details/6176191 Libgdx作者博客:http://www.badlogicgames.com/ Libgdx项目地址:http://code.google.com/p/libgdx/ Libgdx是一款支持2D与3D游戏开发的游戏类库,兼容大多数微机平台(标准JavaSE实现,能执行在Mac.Linux.Windows等系统)与Android平台(Android1.5以上就可以使用.Andro

X Window 程式设计

X Window 程式设计 转   http://www.cppblog.com/zmj/archive/2007/05/18/24331.html X Window 程式设计 X Window 程式设计入门 http://cnpa.yzu.edu.tw/~thinker 作者:李圭烽 (Thinker; [email protected]) (2001-06-01 17:04:00) -------------------------------------------------------