Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
This issue is migrated from here. It was created at 2014/09/03 14:04:14 +0000
Description
Not sure if this is a Windows only problem.
In 3.2/3.3 the cursor Y is flipped in desktop/CCGLView.cpp or desktop/CCGLViewImpl.cpp
// in onGLFWMouseCallBack, onGLFWMouseMoveCallBack and onGLFWMouseScrollCallback
float cursorY = (_viewPortRect.origin.y + viewPortRect.size.height - mouseY) / _scaleY;
These caused two problems:
1)
Similar to Touch the cursor should be in UI points, otherwise it cannot be used in Director::convertToGL() in MouseEvent and cannot be used with Node::convertToNodeSpace()
2)
The range of possible cursor X values is different from the range of possible cursor Y values
For example if my screen size is 960x640
EventMouse::getCursorX() will return [0, 959] but EventMouse::getCursorY() would return [1, 640]
// the possible fix could be:(fix the first problem only in my case)
float cursorY = (_mouseY - viewPortRect.origin.y) / scaleY;
Note
This issue is migrated from here. It was created at 2014/09/03 14:04:14 +0000
Description
Not sure if this is a Windows only problem.
In 3.2/3.3 the cursor Y is flipped in desktop/CCGLView.cpp or desktop/CCGLViewImpl.cpp
// in onGLFWMouseCallBack, onGLFWMouseMoveCallBack and onGLFWMouseScrollCallback float cursorY = (_viewPortRect.origin.y + viewPortRect.size.height - mouseY) / _scaleY;
These caused two problems: 1) Similar to Touch the cursor should be in UI points, otherwise it cannot be used in Director::convertToGL() in MouseEvent and cannot be used with Node::convertToNodeSpace()
2) The range of possible cursor X values is different from the range of possible cursor Y values For example if my screen size is 960x640 EventMouse::getCursorX() will return [0, 959] but EventMouse::getCursorY() would return [1, 640]
// the possible fix could be:(fix the first problem only in my case) float cursorY = (_mouseY - viewPortRect.origin.y) / scaleY;