add global mouse getter (good for clickthrough transparent windows)
This commit is contained in:
parent
b9446863d7
commit
6815f9cb51
|
|
@ -1211,6 +1211,7 @@ RLAPI bool IsMouseButtonUp(int button); // Check if a mous
|
||||||
RLAPI int GetMouseX(void); // Get mouse position X
|
RLAPI int GetMouseX(void); // Get mouse position X
|
||||||
RLAPI int GetMouseY(void); // Get mouse position Y
|
RLAPI int GetMouseY(void); // Get mouse position Y
|
||||||
RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
|
RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
|
||||||
|
RLAPI Vector2 GetMousePositionDesktop(void); // Get mouse position XY
|
||||||
RLAPI Vector2 GetMouseDelta(void); // Get mouse delta between frames
|
RLAPI Vector2 GetMouseDelta(void); // Get mouse delta between frames
|
||||||
RLAPI void SetMousePosition(int x, int y); // Set mouse position XY
|
RLAPI void SetMousePosition(int x, int y); // Set mouse position XY
|
||||||
RLAPI void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
|
RLAPI void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
|
||||||
|
|
|
||||||
19
src/rcore.c
19
src/rcore.c
|
|
@ -3684,7 +3684,26 @@ Vector2 GetMousePosition(void)
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
#include<math.h>
|
||||||
|
|
||||||
|
Vector2 GetMousePositionDesktop(void)
|
||||||
|
{
|
||||||
|
Vector2 position = { 0 };
|
||||||
|
#ifndef PLATFORM_ANDROID
|
||||||
|
int wxpos, wypos;
|
||||||
|
|
||||||
|
glfwGetWindowPos(GetWindowHandle(), &wxpos, &wypos);
|
||||||
|
|
||||||
|
double xpos, ypos;
|
||||||
|
glfwGetCursorPos(GetWindowHandle(), &xpos, &ypos);
|
||||||
|
position.x = wxpos + (floor(xpos));
|
||||||
|
position.y = wypos + (floor(ypos));
|
||||||
|
|
||||||
|
#else
|
||||||
|
return GetMousePosition();
|
||||||
|
#endif
|
||||||
|
return position;
|
||||||
|
}
|
||||||
// Get mouse delta between frames
|
// Get mouse delta between frames
|
||||||
Vector2 GetMouseDelta(void)
|
Vector2 GetMouseDelta(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user