diff --git a/examples/core/core_2d_camera_mouse_zoom.c b/examples/core/core_2d_camera_mouse_zoom.c index 54bc60aa1e46..cd6a75585cd8 100644 --- a/examples/core/core_2d_camera_mouse_zoom.c +++ b/examples/core/core_2d_camera_mouse_zoom.c @@ -56,6 +56,8 @@ int main(void) camera.target = Vector2Add(camera.target, delta); } + Vector2 renderScale = { (float)GetRenderWidth()/GetScreenWidth(), (float)GetRenderHeight()/GetScreenHeight() }; + if (zoomMode == 0) { // Zoom based on mouse wheel @@ -66,7 +68,7 @@ int main(void) Vector2 mouseWorldPos = GetScreenToWorld2D(GetMousePosition(), camera); // Set the offset to where the mouse is, mouse is scaled to viewport space, but offset is in unscaled pixels - camera.offset = Vector2Multiply(GetMousePosition(), GetWindowScaleDPI()); + camera.offset = Vector2Multiply(GetMousePosition(), renderScale); // Set the target to match, so that the camera maps the world space point // under the cursor to the screen space point under the cursor at any zoom @@ -87,7 +89,7 @@ int main(void) Vector2 mouseWorldPos = GetScreenToWorld2D(GetMousePosition(), camera); // Set the offset to where the mouse is, mouse is scaled to viewport space, but offset is in unscaled pixels - camera.offset = Vector2Multiply(GetMousePosition(), GetWindowScaleDPI()); + camera.offset = Vector2Multiply(GetMousePosition(), renderScale); // Set the target to match, so that the camera maps the world space point // under the cursor to the screen space point under the cursor at any zoom diff --git a/examples/core/core_2d_camera_split_screen.c b/examples/core/core_2d_camera_split_screen.c index d32c71b1b8ca..169465f9d361 100644 --- a/examples/core/core_2d_camera_split_screen.c +++ b/examples/core/core_2d_camera_split_screen.c @@ -19,7 +19,6 @@ ********************************************************************************************/ #include "raylib.h" -#include "raymath.h" #define PLAYER_SIZE 40 @@ -40,13 +39,13 @@ int main(void) Camera2D camera1 = { 0 }; camera1.target = (Vector2){ player1.x, player1.y }; - camera1.offset = Vector2Multiply((Vector2){ 200.0f, 200.0f }, GetWindowScaleDPI()); + camera1.offset = (Vector2){ 200.0f, 200.0f }; camera1.rotation = 0.0f; camera1.zoom = 1.0f; Camera2D camera2 = { 0 }; camera2.target = (Vector2){ player2.x, player2.y }; - camera2.offset = Vector2Multiply((Vector2){ 200.0f, 200.0f }, GetWindowScaleDPI()); + camera2.offset = (Vector2){ 200.0f, 200.0f }; camera2.rotation = 0.0f; camera2.zoom = 1.0f; diff --git a/examples/textures/textures_magnifying_glass.c b/examples/textures/textures_magnifying_glass.c index 43827e39a136..51ff9b2a793a 100644 --- a/examples/textures/textures_magnifying_glass.c +++ b/examples/textures/textures_magnifying_glass.c @@ -18,7 +18,6 @@ #include "raylib.h" #include "rlgl.h" // Required for: rlSetBlendFactorsSeparate() -#include "raymath.h" // Required for: Vector2Multiply() //------------------------------------------------------------------------------------ // Program main entry point @@ -47,7 +46,7 @@ int main(void) // Set magnifying glass zoom camera.zoom = 2; // Offset by half the size of the magnifying glass to counteract drawing the texture centered on the mouse position - camera.offset = Vector2Multiply((Vector2){ 128, 128 }, GetWindowScaleDPI()); + camera.offset = (Vector2){ 128, 128 }; SetTargetFPS(60); //--------------------------------------------------------------------------------------