Lore archive · Warcraft Wiki, 2023 dump
API GetCursorPosition
Last wiki revision 2022-07-21
Returns the cursor's position on the screen. x, y = GetCursorPosition
- x: - x coordinate unaffected by UI scale; 0 at the left edge of the screen.
- y: - y coordinate unaffected by UI scale; 0 at the bottom edge of the screen.
local uiScale, x, y = UIParent:GetEffectiveScale, GetCursorPosition local tex = UIParent:CreateTexture tex:SetTexture(1,1,1) tex:SetSize(4,4) tex:SetPoint("CENTER", nil, "BOTTOMLEFT", x / uiScale, y / uiScale)
- Returns scale-independent coordinates similar to Cursor:GetCenter if 'Cursor' was a valid frame not affected by scaling.
- Assuming UIParent spans the entire screen, you can convert these coordinates to UIParent offsets by dividing by its effective scale. The following snippet positions a small texture at the cursor's location.
Source
https://warcraft.wiki.gg/wiki/API_GetCursorPosition · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.