Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setSize cause click bugs #106

Open
atship opened this issue Sep 24, 2017 · 3 comments
Open

setSize cause click bugs #106

atship opened this issue Sep 24, 2017 · 3 comments

Comments

@atship
Copy link

atship commented Sep 24, 2017

Hello,
When I call setSize in a Button and setResAnim, eg.

        spButton btn = new Button;
        btn->setPosition(200, 300);
	btn->setResAnim(res.getResAnim("frame-1"));
	btn->setSize(Vector2(200, 200));
        btn->attachTo(_view);

The button can't click anymore!

The size of frame-1.png is 1100 x 868
The oxyengine-framework is the newest version cloned from master

Can I setSize with any value I want please? Thanks in advanced.

@frankinshtein
Copy link
Contributor

frankinshtein commented Sep 24, 2017

can't reproduce, could you provide modified example.cpp for HelloWorld?
also check DebugActor -> Finger button output

@atship
Copy link
Author

atship commented Sep 25, 2017

Hi, frank
I upload the video to youtube https://youtu.be/w6a7DYh1u3Q
I modify the HelloWorld example.cpp and reproduce it

        //create button Sprite
        spSprite button = new Sprite();

        //setup it:
        //set button.png image. Resource 'button' defined in 'res.xml'
        button->setResAnim(gameResources.getResAnim("button"));
        button->setSize(200, 200);

@atship
Copy link
Author

atship commented Sep 29, 2017

@frankinshtein I tried to modify the code like this, and it works, but I don't know why.

bool Sprite::isOn(const Vector2& localPosition, float localScale)
    {
        if (!Actor::isOn(localPosition, localScale))
            return false;

        if (_extendedIsOn)
            return true;

        const HitTestData& ad = _frame.getHitTestData();
        if (!ad.data || *(ad.data) == 0)
            return true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants