开发者

AndEngine & SurfaceView (CameraPreview)

开发者 https://www.devze.com 2023-01-18 02:28 出处:网络
How do you add a SurfaceView showing the camera preview as the background of the BaseGameActivity of AndEngine (Physics Example).

How do you add a SurfaceView showing the camera preview as the background of the BaseGameActivity of AndEngine (Physics Example).

@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);
            开发者_JAVA百科    //scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));
0

精彩评论

暂无评论...
验证码 换一张
取 消