mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- fixed mouse cursor positioning in menu for Cocoa backend
With video resolution scaling enabled engine coordinates of mouse cursor were wrong
This commit is contained in:
parent
b5274534d7
commit
f8f1148c59
1 changed files with 7 additions and 4 deletions
|
@ -484,11 +484,14 @@ void NSEventToGameMousePosition(NSEvent* inEvent, event_t* outEvent)
|
|||
const NSPoint viewPos = [view convertPointToBacking:windowRect.origin];
|
||||
const CGFloat frameHeight = I_GetContentViewSize(window).height;
|
||||
|
||||
const CGFloat posX = ( viewPos.x - rbOpts.shiftX) / rbOpts.pixelScale;
|
||||
const CGFloat posY = (frameHeight - viewPos.y - rbOpts.shiftY) / rbOpts.pixelScale;
|
||||
outEvent->data1 = static_cast<int16_t>( viewPos.x);
|
||||
outEvent->data2 = static_cast<int16_t>(frameHeight - viewPos.y);
|
||||
|
||||
outEvent->data1 = static_cast<int>(posX);
|
||||
outEvent->data2 = static_cast<int>(posY);
|
||||
// Compensate letterbox adjustment done by cross-platform code
|
||||
// More elegant solution is a bit problematic due to HiDPI/Retina support
|
||||
outEvent->data2 += (screen->GetTrueHeight() - screen->VideoHeight) / 2;
|
||||
|
||||
screen->ScaleCoordsFromWindow(outEvent->data1, outEvent->data2);
|
||||
}
|
||||
|
||||
void ProcessMouseMoveInMenu(NSEvent* theEvent)
|
||||
|
|
Loading…
Reference in a new issue