mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
make mac pos accurate to cocos2d positioning
This commit is contained in:
parent
d7b0e09779
commit
8fc23e14da
1 changed files with 3 additions and 1 deletions
|
@ -142,8 +142,10 @@ Result<std::vector<ghc::filesystem::path>> utils::file::pickFiles(
|
|||
}
|
||||
|
||||
CCPoint cocos::getMousePos() {
|
||||
auto frame = NSApp.mainWindow.frame;
|
||||
auto scaleFactor = CCPoint(CCDirector::get()->getWinSize()) / ccp(frame.size.width, frame.size.height);
|
||||
auto mouse = [NSEvent mouseLocation];
|
||||
return ccp(mouse.x, mouse.y);
|
||||
return ccp(mouse.x - frame.origin.x, mouse.y - frame.origin.y) * scaleFactor;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue