AndEngine& SurfaceView(CameraPreview)

时间:2010-09-30 20:32:56

标签: android game-engine surfaceview andengine

如何添加一个SurfaceView,显示相机预览作为AndEngine的BaseGameActivity的背景(物理示例)。

@Override
        public Scene onLoadScene() {
                mBackgroundView = new PreviewView(this);
                addContentView(mBackgroundView, new LayoutParams(
                                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));    // Does not work
                addContentView(mBackgroundView.getOverlay(), new LayoutParams(    
                                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));   // Works. getOverlay() returns an ImageView.

                final Scene scene = new Scene(1);
                //scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));

0 个答案:

没有答案