Having an issue with my buttons on Windows, using 3.10 [Solved!]

Now that my game has been Greenlit and will be on Windows, I’m stepping up my work on the Windows version, and I’ll need to look at several topics, including just how do I test it on a windows machine separate than my development machine (I still have Windows 7, and I’d like to test it on one of our Windows 10 machines).

In fact, I guess my first question is, am I using the correct project and settings? I’m working with the proj.win32 project. When would I work with the proj.win10 or proj.win8.1-universal projects instead?

However, my more pressing issue is with buttons, and only on my wife’s laptop, which is running Windows 8.1. My buttons run great on windows 7, my iPhone, android, and my Mac simulator.

I created my own button classes back when I wrote the first version several years ago, and rather than ripping all that out, I’d like to see if I can get mine to work. Here’s the problem I’m having. On my iPhone and on the simulator on the Mac, the touch area of the buttons matches perfectly. However, on Windows, I have to tap in the lower part of the button for my touch to be detected. Even worse, the touch area seems to start about midway down from the top of the button and extend past the bottom of the button.

Here’s what I’ve done. I created a class FlexButton (which I can easily configure), which is a subclass of cocos2d::extension::ControlButton. When I create the button, I call addTargetWithActionForControlEvents() with TOUCH_UP_INSIDE. I have logic in the onTouchEnded() method to detect that you’re actually releasing while in the button.

if (nodeContainsTouch(this, touch))
{
this->sendActionsForControlEvents(Control::EventType::TOUCH_UP_INSIDE);
}

and the nodeContainsTouch() method, which accounts for the button having children

bool nodeContainsTouch(Node *node, Touch *touch)
{
// first see if the node itself contains the touch
Vec2 p = touch->getLocation();
cocos2d::Rect rect = node->getBoundingBox();

p = node->convertToNodeSpace§;
rect = Rect(0, 0, node->getContentSize().width, node->getContentSize().height);

if (rect.containsPoint§)
{
// CCLOG(“nodeContainsTouch, node itself”);
return true;
}

// now check the children
bool found = false;
Point tp = Director::getInstance()->convertToGL(touch->getLocationInView());
tp = node->convertToNodeSpace(tp);

for (auto child : node->getChildren())
{
if (child->getBoundingBox().containsPoint(tp))
{
// CCLOG(“nodeContainsTouch, child node”);
found = true;
break;
}
}
return found;
}

I don’t know whether it’s her laptop or a problem with Windows 8.1 or what. Any suggestions would be great.

Thanks!

I found the problem. It’s fairly weird, but it turns out that if I launch the app in full screen mode or in a more reasonable window size, then this problem doesn’t happen.