繁体   English   中英

无法捕获AndEngine中的屏幕截图

[英]Unable to Capture Screen shot In AndEngine

您好,这是我的代码。

public static void TakeScreenShot(String FileName)
{ 
         Log.d("Screen"," Path "+ FileName);

        scr.capture(CAMERA_WIDTH, CAMERA_HEIGHT, FileName, new IScreenCaptureCallback() {
            @Override
            public void onScreenCaptured(final String pFilePath) { 
                Log.d("Screen","Yes "+ pFilePath);

            }

            @Override
            public void onScreenCaptureFailed(final String pFilePath, final Exception pException) { 
                Log.d("Screen","NO "+ pFilePath+"    "+pException);

            }
        });
    }

第一个日志运行正常。 但是随后没有其他日志在起作用。 它没有完成也没有失败。 有人可以给我解决办法吗?

我保存的路径是“ /mnt/sdcard/cmtdd.png”

以下可能有效。.我添加了scene.attachChild(screenCapture); 您的代码。 应该在正确的地方使用。

public static void TakeScreenShot(String FileName)
{ 
         Log.d("Screen"," Path "+ FileName);

        scene.attachChild(screenCapture); // Attaching screen capture after all rendered.

        scr.capture(CAMERA_WIDTH, CAMERA_HEIGHT, FileName, new IScreenCaptureCallback() {
            @Override
            public void onScreenCaptured(final String pFilePath) { 
                Log.d("Screen","Yes "+ pFilePath);

            }

            @Override
            public void onScreenCaptureFailed(final String pFilePath, final Exception pException) { 
                Log.d("Screen","NO "+ pFilePath+"    "+pException);

            }
        });
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM