摄像头作为一个定制的CCLayer(cocos2d的Andr​​oid设备)的背景? [英] Camera as background in a customized CCLayer ( cocos2d for Android )?

查看:352
本文介绍了摄像头作为一个定制的CCLayer(cocos2d的Andr​​oid设备)的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用相机的自定义CCLayer(cocos2d的Andr​​oid设备),即加入VideoView到CCLayer?

相机不需要拍照功能;只显示视图是好的。是的,我想用相机手机。

我用下面的codeS现身摄像头:

 意图cameraIntent =新意图(android.provider.MediaStore.ACTION_IM​​AGE_CAPTURE);
theActivity.startActivity(cameraIntent);

但视图重叠的一切,几秒钟后会崩溃。该错误是:

  NullPointerException异常在org.cocos2d.nodes.CCDirector.drawCCScene(CCDirector.java:680)


解决方案

不知道这是如何在陌生的跨平台框架完成,但摄像头preVIEW可以很容易地通过管道输送pretty任何表面视图你可以用其他的接口它覆盖
对象(除非是表面的看法)。有展示如何做到这一点的Andr​​oid SDK的例子

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)

解决方案

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

这篇关于摄像头作为一个定制的CCLayer(cocos2d的Andr​​oid设备)的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆