Camera as background in a customized CCLayer ( cocos2d for Android )?

无人久伴 提交于 2019-12-11 22:45:02

问题


How to use camera in a customized CCLayer ( cocos2d for Android ) , i.e. adding VideoView to CCLayer ?

The camera does not require photo taking feature; only showing the view is fine. Yes, I would like to use the camera on mobile phone.

I use the following codes to show up the camera:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
theActivity.startActivity(cameraIntent);

but the view overlaps everything and will crash after few seconds. The error is:

NullPointerException at org.cocos2d.nodes.CCDirector.drawCCScene(CCDirector.java:680)

回答1:


Not sure how this is done in your strange cross-platform framework, but camera preview can be piped pretty easily to any surface view and you can overlay it with other interface objects (unless they are surface views). There are android SDK examples showing how to do this



来源:https://stackoverflow.com/questions/8239623/camera-as-background-in-a-customized-cclayer-cocos2d-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!