Skip to content

Commit 7f0e933

Browse files
committed
mouseLocation is not a method oops
1 parent 1de70c4 commit 7f0e933

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/macos.mm

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,17 @@ inline bool keyDown(PlatformKey key, NSEvent* event)
4242
auto window = [event window];
4343
auto windowFrame = [window frame];
4444
auto viewFrame = [[window contentView] frame];
45-
auto scaleFactor = cocos2d::CCPoint{ cocos2d::CCDirector::get()->getWinSize() } / cocos2d::CCPoint{ viewFrame.size.width, viewFrame.size.height };
46-
auto mouse = [event mouseLocation];
45+
auto scaleFactor = cocos2d::CCPoint{
46+
cocos2d::CCDirector::get()->getWinSize()
47+
} / cocos2d::CCPoint{
48+
static_cast<float>(viewFrame.size.width),
49+
static_cast<float>(viewFrame.size.height)
50+
};
51+
auto mousePos = event.mouseLocation;
4752

4853
return cocos2d::CCPoint{
49-
mouse.x - windowFrame.origin.x,
50-
mouse.y - windowFrame.origin.y
54+
mousePos.x - windowFrame.origin.x,
55+
mousePos.y - windowFrame.origin.y
5156
} * scaleFactor;
5257
}
5358
}

0 commit comments

Comments
 (0)