bgiGetCanvasMouseX

Returns the canvas-relative X coordinate of the mouse cursor. Takes canvasID (Int). Returns 0.

BGI GUI

Parameters & Returns

Parameters

canvasID Int

Returns

Int

Quick Summary

Returns the canvas-relative X coordinate of the mouse cursor. Takes canvasID (Int). Returns 0.

Technical Exegesis...

Returns the canvas-relative X coordinate of the mouse cursor. Searches g_canvasMap for canvasID. If not found, returns 0. Calls GetCursorPos to get screen cursor position. If GetCursorPos fails, returns last known position from g_canvasLastMousePos map (or 0 if no cached position). Calls ScreenToClient with canvas hWnd to convert screen coordinates to canvas client-area coordinates. If ScreenToClient fails, returns last known position. Checks if cursor is within canvas bounds (cursorPos.x >= 0 && cursorPos.

Example

Example.bam
; No example implemented yet