Narendrabrsoft / cocos2d-android-1

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

this CCMenuItemImage touch positon error #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
this CCMenuItemImage  touch positon error

What is the expected output? What do you see instead?
I used last source cocos2d v0.99.4
when Main.SCALE is not equal 1,the position touched is error position
CCMenuItemImage touch positon error
If I used the cocos2d-android.jar in source libs dir
can not find the function "test"

What version of the product are you using? On what operating system?

Please provide any additional information below.

public class GameStartScreen extends CCLayer {

    public static CCScene scene() {

        CCScene result = CCScene.node();

        //result.addChild(BackGround.getBackGround());
        result.addChild(new GameStartScreen());
        result.setScale(Main.SCALE);
        return result;
    }

    public GameStartScreen()
    {

        CGSize s = CCDirector.sharedDirector().winSize();

        CCSprite bg = CCSprite.sprite("images/bg.jpg");

        bg.setPosition(CGPoint.make(s.width / 2f, s.height / 2f));
        this.addChild(bg);

        CCMenuItemImage item1 = CCMenuItemImage.item("images/easy.png", "images/easy_down.png", this, "test");
(R.string.easy), null, 42);
        CCMenuItemImage item2 = CCMenuItemImage.item("images/normal.png", "images/normal_down.png", this, "test");
        CCMenuItemImage item3 = CCMenuItemImage.item("images/difficulty.png", "images/difficulty_down.png", this, "test");

        CCMenu menu = CCMenu.menu(item1, item2, item3);

        menu.setPosition(CGPoint.make(0, 0));
        item1.setPosition(CGPoint.make(630, 361));
        item2.setPosition(CGPoint.make(630, 272));
        item3.setPosition(CGPoint.make(630, 183));

        menu.alignItemsVertically();

        bg.addChild(menu, 1);

    }

    public void test(Object sender)
    {
        Log.i("test","test click");
    }

}

Original issue reported on code.google.com by cgj1...@gmail.com on 11 Mar 2011 at 5:25

GoogleCodeExporter commented 8 years ago
没有
       menu.alignItemsVertically();

Original comment by cgj1...@gmail.com on 12 Mar 2011 at 6:07

GoogleCodeExporter commented 8 years ago
class CCNode

function

private void nodeToWorldTransform(CGAffineTransform ret) {
        ret.setTransform(nodeToParentTransform());

        for (CCNode p = parent_; p != null; p = p.parent_) {
            // t = t.getTransformConcat(p.nodeToParentTransform());
            ret.multiply( p.nodeToParentTransform() );
//            t = t.preConcatenate(p.nodeToParentTransform());
        }
    }

Original comment by cgj1...@gmail.com on 12 Mar 2011 at 9:21

GoogleCodeExporter commented 8 years ago
change to this:

   private void nodeToWorldTransform(CGAffineTransform ret) {
        ret.setTransform(nodeToParentTransform());

        for (CCNode p = parent_; p != null; p = p.parent_) {
            // t = t.getTransformConcat(p.nodeToParentTransform());
             ret.setTransform(ret.preConcatenate(p.nodeToParentTransform() ));
//            t = t.preConcatenate(p.nodeToParentTransform());
        }
    }

Original comment by cgj1...@gmail.com on 12 Mar 2011 at 2:26

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
fixed

Original comment by opengen...@gmail.com on 29 Mar 2011 at 11:50