- Fix mouse position being wrong when vid_scalemode is active
This commit is contained in:
parent
3540440bf6
commit
7d21fe6d75
4 changed files with 59 additions and 17 deletions
|
|
@ -548,3 +548,18 @@ void OpenGLFrameBuffer::GameRestart()
|
|||
gl_GenerateGlobalBrightmapFromColormap();
|
||||
}
|
||||
|
||||
|
||||
void OpenGLFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
|
||||
{
|
||||
int letterboxX = GLRenderer->mOutputLetterbox.left;
|
||||
int letterboxY = GLRenderer->mOutputLetterbox.top;
|
||||
int letterboxWidth = GLRenderer->mOutputLetterbox.width;
|
||||
int letterboxHeight = GLRenderer->mOutputLetterbox.height;
|
||||
|
||||
// Subtract the LB video mode letterboxing
|
||||
if (IsFullscreen())
|
||||
y -= (GetTrueHeight() - VideoHeight) / 2;
|
||||
|
||||
x = int16_t((x - letterboxX) * Width / letterboxWidth);
|
||||
y = int16_t((y - letterboxY) * Height / letterboxHeight);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue