diff options
| author | Matheus Duarte <[email protected]> | 2020-12-28 07:10:39 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-28 11:10:39 +0100 |
| commit | 227496bea7bd5e986ee39a888c25ec2169c491d5 (patch) | |
| tree | ffb224758a848cdf9f2a29ef6728dddaff25cce7 | |
| parent | 068fc48fdad0fbc78b9c6da2805e231e4bb15618 (diff) | |
| download | raylib-227496bea7bd5e986ee39a888c25ec2169c491d5.tar.gz raylib-227496bea7bd5e986ee39a888c25ec2169c491d5.zip | |
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)
| -rw-r--r-- | examples/core/core_window_letterbox.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/core/core_window_letterbox.c b/examples/core/core_window_letterbox.c index 4402dd2a..f28f2a5f 100644 --- a/examples/core/core_window_letterbox.c +++ b/examples/core/core_window_letterbox.c @@ -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 |
