Narendrabrsoft / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

CCMenu alignItemsHorizontally doesn't work (fix included) #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
A minus sign should be  a plus sign in CCMenu's 
alignItemsHorizontallyWithPadding:

In the second for loop of the method, the following code should be changed: 
originally it is

float x = -width / 2.0f;
        for (CCNode item : children_) {
            item.setPosition(CGPoint.make(x + item.getContentSize().width * item.getScaleX() / 2.0f, 0));
            x -= item.getContentSize().width * item.getScaleX() + padding;
        }

But should be changed to:

float x = -width / 2.0f;
        for (CCNode item : children_) {
            item.setPosition(CGPoint.make(x + item.getContentSize().width * item.getScaleX() / 2.0f, 0));
            x += item.getContentSize().width * item.getScaleX() + padding;
        }

Original issue reported on code.google.com by ghemp...@gmail.com on 25 Jan 2011 at 5:55