Archive for the ‘android’ Category

Implementing CCCallFunc Cocos2d-X 2.0

Thursday, August 2nd, 2012

This is a simple way of implementing CCCallFunc.

ClassA wants to pass a function reference to ClassB.

CCCallFunc calls a function without any parameters. If you want to get the CCObject that called it then use CCCallFuncN and if you want to pass your own data use CCCallFuncND

In ClassB header create a variable to hold the callFunction.

In ClassB implementation call the passed in function.

In class ClassA implementation.

Creating Frame Animation in Cocos2d-X 2.0 Using a Sprite Sheet

Saturday, July 28th, 2012

Since the Cocos2d-X 2.0 rc2 a lot of the initialisation has changed so this code works in Cocos2d-X 2.0.

First create a sprite sheet so we can load it in.

Once you have created the Sprite Sheet you will end up with a image file and plist.

mySprites.png
mySprites.plist

I like to name my sprites like this:

jumpAnimation_00
jumpAnimation_01
jumpAnimation_02
jumpAnimation_03
jumpAnimation_04
jumpAnimation_05

walkAnimations_00
walkAnimations_01
walkAnimations_02
walkAnimations_03
walkAnimations_04
walkAnimations_05

It makes creating the animations easier. My code below is depended on the above naming convention.

Nexus One 3G bug(O2 UK) and Wifi bug

Tuesday, February 2nd, 2010

I was totally stocked to get my Nexus One. When I got the N1 though, it did take some doing to get it working. Here are the issues I found and the solutions to the problems. Now you can find these solutions all over the net but I am just centralizing all the solutions please add any others you have found in the comments and I will update the post.

Problem:
Wifi not getting passed the “Obasdtaining IP” msg and not connecting even though the login details are correct.

Solution A:
This seems to be a temporary issue associated with the specific session of the wireless network. The easiest solution is to reset the router.
Problem:
No 3G or Edge signal at all(this does not mean flaky this means you never get any signal at all). This happened to me on O2.

Solution A:
Find your Carrier APN(Access Point Name) see O2 details below:

Name: mobile web
APN: mobile.o2.co.uk
Username: web
Password: password
MCC: 234
MNC: 10
APN Type: default

What ever details you dont see above leave blank. The settings in the N1 is Settings>>Wireless & network>>Mobile networks>>Access point names>>menu>>add>>ENTER YOUR APN DETAILS (O2 IS ABOVE )

Problem:
My 3G signal is poor. I have signal but its not very good.
Solution C:
Final solution from google fixes 3g signal bug and adds multitouch to all apps:

http://googlephoneblog.net/2010/02/03/force-update-your-nexus-ones-software-to-enable-multitouch/

this will be an over the air update at some point.

Solution B:
Settings>>Wireless & Netowrk>> Mobile networks>>Network operators>>Tap Automatically
The bottom of the screen should you should see Registered. Job done you should see improvements immediately.

Solution C:
Dial *#*#4636#*#*>>Phone Information>>Change ‘WCDMA preferred’ to ‘WCDMA only’ at the bottom of the page. WCDMA is 3G so this setting forces it to only use 3G which means when there is no 3G signal u will get no net coverage. When u make the switch and get your strong 3G signal switch it back to ‘WCDMA preferred’ and you should find that your are still on good signal.

Hope that helps.

Stackoverflow Inspiration and Learning Event

Friday, July 3rd, 2009

The popular code question and answer site http://stackoverflow.com/ are having a few inspiration and learning events this year. I am keen to see what android and objective-c stuff will be on offer you can get tickets from: http://stackoverflow.carsonified.com/