ANDROID ANDENGINE — Set Scene background as traspa

2019-08-13 11:43发布

­I'm starting to use AndEngine in my app. I've used an xml to define the base style of the app. I've defined a scene in which I'll have some draggable sprites.

I've imported correctly the xml but the scene appears on top of that with a black background that hides the xml graphics. I need to set the scene with transparent background.

How can i do that?

3条回答
在下西门庆
2楼-- · 2019-08-13 11:56

Actually you can do that.

It was at least working some time ago with AndEngine running on top of a Camera preview.

It has really been a while since I did this and I didn't keep it up to date, but this class should be of interest for you: http://code.google.com/p/andengineaugmentedrealityextension/source/browse/src/org/anddev/andengine/extension/augmentedreality/BaseAugmentedRealityGameActivity.java

查看更多
来,给爷笑一个
3楼-- · 2019-08-13 11:58

The default background of the scene is black. you can't change it.

查看更多
混吃等死
4楼-- · 2019-08-13 12:13

It can change . Use this code.

 @Override
    public Scene onLoadScene() {
            this.mEngine.registerUpdateHandler(new FPSLogger());

            final Scene scene = new Scene();
            scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
查看更多
登录 后发表回答