Move SetMousePosition out of rcore
This commit is contained in:
parent
a18fe28e6f
commit
ea71464653
12
src/rcore.c
12
src/rcore.c
|
|
@ -2085,18 +2085,6 @@ Vector2 GetMouseDelta(void)
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
|
||||||
void SetMousePosition(int x, int y)
|
|
||||||
{
|
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
|
||||||
// NOTE: emscripten not implemented
|
|
||||||
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set mouse offset
|
// Set mouse offset
|
||||||
// NOTE: Useful when rendering to different size targets
|
// NOTE: Useful when rendering to different size targets
|
||||||
void SetMouseOffset(int offsetX, int offsetY)
|
void SetMouseOffset(int offsetX, int offsetY)
|
||||||
|
|
|
||||||
|
|
@ -1668,4 +1668,11 @@ int GetMouseY(void)
|
||||||
Vector2 GetMousePosition(void)
|
Vector2 GetMousePosition(void)
|
||||||
{
|
{
|
||||||
return GetTouchPosition(0);
|
return GetTouchPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set mouse position XY
|
||||||
|
void SetMousePosition(int x, int y)
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1557,4 +1557,14 @@ Vector2 GetMousePosition(void)
|
||||||
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set mouse position XY
|
||||||
|
void SetMousePosition(int x, int y)
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
|
||||||
|
// NOTE: emscripten not implemented
|
||||||
|
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,4 +998,11 @@ Vector2 GetMousePosition(void)
|
||||||
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set mouse position XY
|
||||||
|
void SetMousePosition(int x, int y)
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1598,4 +1598,14 @@ Vector2 GetMousePosition(void)
|
||||||
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set mouse position XY
|
||||||
|
void SetMousePosition(int x, int y)
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
|
||||||
|
// NOTE: emscripten not implemented
|
||||||
|
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user