Today i saw a question on the forum at cocos2d-x.org asking about how to get the cocos2d-x application to run as a live wallpaper.
Most of the basics come from the sample application provided by google, but since cocos2d-x is designed under the assumption that its' always used as an application you will have to change a few things here and there.
So ive' quickly made some dirty adjustments to the code pasted on the forum to get the sample code running as a live wallpaper. Here is the screenshot of the default one running.
Im' excited to see what the cocos2d-x app devs can do once they start developing the live wallpapers. ..
Here are the steps you should follow:
1) Open the .java file created in proj.android/src/your packagename/*.java
2) Modify it based on the java file embedded below.
3) Modify the AndroidManifest.xml file to make it behave like a wallpaper.
Build and deploy the app just like any other cocos2d-x application. If everything went right you should see your app listed among the liveWallpapers section in your phone.
AndroidManifest.xml has to be modified. Then the code in your java file should be changed to this.
Most of the basics come from the sample application provided by google, but since cocos2d-x is designed under the assumption that its' always used as an application you will have to change a few things here and there.
So ive' quickly made some dirty adjustments to the code pasted on the forum to get the sample code running as a live wallpaper. Here is the screenshot of the default one running.
Sample Cocos2D-x app as Live Wallpaper |
Here are the steps you should follow:
1) Open the .java file created in proj.android/src/your packagename/*.java
2) Modify it based on the java file embedded below.
3) Modify the AndroidManifest.xml file to make it behave like a wallpaper.
Build and deploy the app just like any other cocos2d-x application. If everything went right you should see your app listed among the liveWallpapers section in your phone.
AndroidManifest.xml has to be modified. Then the code in your java file should be changed to this.
Comments