ANDROID ANDENGINE — Set Scene background as trasparent
-
14-02-2021 - |
Question
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?
La solution
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
Autres conseils
The default background of the scene is black. you can't change it.
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));