davanp
davanp

Reputation: 133

How to set layout BEHIND AndEngine scene?

Does anyone know how to orient your main layout so that it is behind an Andengine scene?

What I am trying to do is overlay some AndEngine controls on top of a video stream that fills the whole screen. My video stream comes from a website, so I'm using WebView.

I thought to set the background as transparent, so that a layout could be shown underneath, but I don't know how to orient the layout this way. Basically, I'd welcome ANY way by which I can display my webview as the "background" of my app while still having the controls (that are similar to AnalogOnScreenControls) visible overtop (in the bottom left and top right corner).

If not possible, I'd settle for just implementing a webview into my andengine code, which I've done some research on, but have never actually successfully done. Any help would be greatly appreciated

Upvotes: 2

Views: 1575

Answers (1)

Plastic Sturgeon
Plastic Sturgeon

Reputation: 12527

Check out the AugmentedRealityExample in the andengine examples. It features Sprites drawn ove live camera feed.

http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/AugmentedRealityExample.java?spec=svndc80a85976df8d8f49268a4c0b64c3ac6be5c328&r=07a5aabdd0ce738a624863ca8d18895350a23356

It appears the trick is to just create a scene with a transparent background: scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));

Be suire to check the superclass "BaseAugmentedRealityGameActivity" to see where he attaches the camera feed using a "CameraPreviewSurfaceView". The cameraPreviewSurfaceView extends plain old Vanilla Android.SurfaceView - so from that starting point you should be able to get accomplished what you need.

Upvotes: 2

Related Questions