File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments