cocos2d-android

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:

Cocos2D Touch HELP

[亡魂溺海] 提交于 2019-12-11 10:07:11
问题 I`m new to cocos2d library, I worked before with libgdx and pure openGL. How can I handle a touch event in Cocos2d for Android? 回答1: The 4 methods for handling touches on android are defined as follows: public boolean ccTouchesBegan(MotionEvent event); public boolean ccTouchesMoved(MotionEvent event); public boolean ccTouchesEnded(MotionEvent event); public boolean ccTouchesCancelled(MotionEvent event); These are the listeners you should use. And also add below line in constructor of your

[Cocos2d]How to Create bitmap from GlSurfaceView

北城以北 提交于 2019-12-10 17:31:43
问题 How can I take screen shot of Glsurfaceview in Cocos2d. I tried with following code using GLsurfaceView GlsurfaceView glv=CCDirector.sharedDirector().getOpenGLView(); glv.setDrawingCacheEnabled(true); Bitmap bitmap=glv.getDrawingCache(); but it return transparent image. 回答1: I got answer from this anddev forum question I attached code along with this hope somebody will find this helpful Please Put this code inside renderer class onDraw Method inside starting. public static Bitmap SavePixels

How to get sprites react to touches in cocos2d android?

别等时光非礼了梦想. 提交于 2019-12-10 14:43:44
问题 i have 1 gun when tap on any point on the screen bullets fires out, but according to my requirement there are 3 guns(sprites) when touched on any of the sprites bullets must fire up, when googled i came to know that this can be done by using targetedTouchDelegate or to loop all the spirites and set flag for each touched sprite, i have seen the code for this in iphone, but could not find for android, please can anybody tell how to use do this in android? or any links or books for cocos2d

How to remove the sprite when I touch on it in cocos2d android?

独自空忆成欢 提交于 2019-12-08 13:00:09
问题 I tried this for the solution .... public void update(float dt) { CGRect targetRect = CGRect.make(target.getPosition().x -(target.getContentSize().width),target.getPosition().y - (target.getContentSize().height),target.getContentSize().width,target.getContentSize().height); if (CGRect.containsPoint(targetRect, location)) { spriteMoveFinished(target); } } but i can't get the result. 回答1: I have checked your code You have not scheduled the method update. I have moved the update method coding to

I'm unable to get WiEngine skeleton project to run

落爺英雄遲暮 提交于 2019-12-08 11:31:42
问题 So I'm trying to port some cocos2d iOS apps over to Android and it looks like WiEngine is the most fully featured port of cocos2d to android ( http://www.wiyun.com/web/wiengine ), however I'm having issues getting the skeleton project to run. The latest problem I'm running into is I get a "Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/wiyun/engine/skeleton/Skeleton" error in the ADB. I'm trying to run it in the emulator which also may be an issue. I'm kind of stuck

Surface view as a bitmap in android

廉价感情. 提交于 2019-12-07 11:00:53
问题 I'm using cocos2d. Now I've added some images in the layer, and played around a bit. I'm trying to save the whole screen as image file. How can I do this? 回答1: It is my understanding that cocos2d-android also has a CCRenderTexture class with the saveBuffer method. In that case have a look at my CCRenderTexture demo program and blog post for cocos2d-iphone which gives you an example for how to create a screenshot using CCRenderTexture and saveBuffer. The same principle should be applicable to

Should I use cocos2D or andengine?

久未见 提交于 2019-12-06 09:05:02
问题 What is the project the more active/Stable? Can you say me the deep diference between cocos2D and andengine? 回答1: I'm using AndEngine for one of my projects, and I must say, it's rather nice. A little comparision between LibGDX and AndEngine: 1) AndEngine Only for Android. High level, you propably won't need any direct calls for GL functions. Quite easy to learn, and to code with. There are versions (source) for OpenGL ES 1.0 / 1.1 / 2.0 (with support for shaders) 2) LibGDX Multiplatform

Cocos2d-x error while compiling LOCAL_SRC_FILES points to a missing file (and folder) Windows

限于喜欢 提交于 2019-12-05 11:22:27
Good evening. I'm stuck trying to compile a HelloWorld using the cocos2d-x. I used the following commands: cocos compile -p android --android-studio cocos compile -p android --android-studio cocos compile -p android And I always had the same answer Android NDK: ERROR:C:\Users\santi_000\Desktop\Android\cocos2d\HelloWorld\proj.android\../cocos2d/external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to the missing file Android NDK: Check que C:/Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android/../cocos2d/external/freetype2/prebuilt/android

Has anyone run their game on Higher Resolution in Cocos2d-android?

≡放荡痞女 提交于 2019-12-04 16:32:14
CCScene doesn't show anything on higher resolution ? I am working on a project in which I'm using the cocos2d_android.jar and on the 4.3 version the screen goes blank and music/ccTouches/others things working fine. Even after I change the jar file with the API level 18(4.3 version), Add into my project and there is no error in the import time and uses their classes but in the RunTimeError occurred like : 09-14 07:49:49.890: E/AndroidRuntime(1282): FATAL EXCEPTION: GLThread 102 09-14 07:49:49.890: E/AndroidRuntime(1282): java.lang.NullPointerException 09-14 07:49:49.890: E/AndroidRuntime(1282):