mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-10 01:09:10 -04:00
REVIEWED: PR #5679
This commit is contained in:
@ -1447,28 +1447,26 @@ void PollInputEvents(void)
|
|||||||
} break;
|
} break;
|
||||||
case RGFW_mousePosChanged:
|
case RGFW_mousePosChanged:
|
||||||
{
|
{
|
||||||
float event_x = 0.0f, event_y = 0.0f;
|
float mouseX = 0.0f;
|
||||||
|
float mouseY = 0.0f;
|
||||||
if (RGFW_window_isCaptured(platform.window))
|
if (RGFW_window_isCaptured(platform.window))
|
||||||
{
|
{
|
||||||
event_x = (float)rgfw_event.mouse.vecX;
|
mouseX = (float)rgfw_event.mouse.vecX;
|
||||||
event_y = (float)rgfw_event.mouse.vecY;
|
mouseY = (float)rgfw_event.mouse.vecY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event_x = (float)rgfw_event.mouse.x;
|
mouseX = (float)rgfw_event.mouse.x;
|
||||||
event_y = (float)rgfw_event.mouse.y;
|
mouseY = (float)rgfw_event.mouse.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
{
|
double canvasWidth = 0.0;
|
||||||
double canvasWidth = 0.0;
|
double canvasHeight = 0.0;
|
||||||
double canvasHeight = 0.0;
|
emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
|
||||||
emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
|
mouseX *= ((float)GetScreenWidth()/(float)canvasWidth);
|
||||||
event_x *= ((float)GetScreenWidth() / (float)canvasWidth);
|
mouseY *= ((float)GetScreenHeight()/(float)canvasHeight);
|
||||||
event_y *= ((float)GetScreenHeight() / (float)canvasHeight);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (RGFW_window_isCaptured(platform.window))
|
if (RGFW_window_isCaptured(platform.window))
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition.x += event_x;
|
CORE.Input.Mouse.currentPosition.x += event_x;
|
||||||
|
|||||||
Reference in New Issue
Block a user