providing and example on how to apply the screen scale (as done in the virtual mouse) to the real mouse, to work with raygui (#1481)

This commit is contained in:
Matheus Duarte 2020-12-28 07:10:39 -03:00 committed by GitHub
parent 068fc48fda
commit 227496bea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,11 @@ int main(void)
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight });
// Apply the same transformation as the virtual mouse to the real mouse, to work with raygui.
// SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth * scale)) * 0.5f, -(GetScreenHeight() - (gameScreenHeight * scale)) * 0.5f);
// SetMouseScale(1 / scale, 1 / scale);
//----------------------------------------------------------------------------------
// Draw