Added comments and review some functions #3313

This commit is contained in:
Ray 2023-10-10 11:59:41 +02:00
commit 101a9b0445

View file

@ -563,17 +563,10 @@ void OpenURL(const char *url)
// Module Functions Definition: Inputs
//----------------------------------------------------------------------------------
// Set a custom key to exit program
void SetExitKey(int key)
{
TRACELOG(LOG_WARNING, "SetExitKey() not implemented on target platform");
}
// Get gamepad internal name id
const char *GetGamepadName(int gamepad)
{
TRACELOG(LOG_WARNING, "GetGamepadName() not implemented on target platform");
return NULL;
return CORE.Input.Gamepad.name[gamepad];
}
// Get gamepad axis count
@ -592,19 +585,25 @@ int SetGamepadMappings(const char *mappings)
// Get mouse position X
int GetMouseX(void)
{
return (int)CORE.Input.Touch.position[0].x;
return (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x);
}
// Get mouse position Y
int GetMouseY(void)
{
return (int)CORE.Input.Touch.position[0].y;
return (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y);
}
// Get mouse position XY
Vector2 GetMousePosition(void)
{
return GetTouchPosition(0);
Vector2 position = { 0 };
// NOTE: On canvas scaling, mouse position is proportionally returned
position.x = (CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x;
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
return position;
}
// Set mouse position XY