Checks if the mouse cursor is currently positioned over a canvas.
Takes canvasID (Int).
Returns 0.
BGI GUI
Parameters & Returns
Parameters
canvasIDInt
Returns
Int
Quick Summary
Checks if the mouse cursor is currently positioned over a canvas.
Takes canvasID (Int).
Returns 0.
Technical Exegesis...
Checks if the mouse cursor is currently positioned over a canvas. Searches g_canvasMap for canvasID. If not found, returns 0. Calls GetCursorPos to get screen cursor position. If GetCursorPos fails, returns 0. Calls ScreenToClient with canvas hWnd to convert screen coordinates to canvas client-area coordinates. If ScreenToClient fails, returns 0. Checks if cursor is within canvas bounds (cursorPos.x >= 0 && cursorPos.x < width && cursorPos.y >= 0 && cursorPos.y < height).
Checks if the mouse cursor is currently positioned over a canvas. Searches g_canvasMap for canvasID. If not found, returns 0. Calls GetCursorPos to get screen cursor position. If GetCursorPos fails, returns 0. Calls ScreenToClient with canvas hWnd to convert screen coordinates to canvas client-area coordinates. If ScreenToClient fails, returns 0. Checks if cursor is within canvas bounds (cursorPos.x >= 0 && cursorPos.x < width && cursorPos.y >= 0 && cursorPos.y < height). Returns 1 if mouse is over canvas, 0 if outside or canvas not found.
This function provides boolean hover detection for canvases. Returns 1 (true) when mouse is inside canvas boundaries, 0 (false) otherwise. GetCursorPos queries current global cursor position. ScreenToClient converts to canvas-local coordinates. Boundary check tests all four edges (left, top, right, bottom). Use for hover effects, conditional input handling, cursor changes, tooltip triggers. Does NOT cache position (unlike bgiGetCanvasMouseX/Y) - always queries current state. Returns 0 for invalid canvas or API failures. Common pattern: if bgiIsMouseOverCanvas(canvas1) then process canvas1 input, else if bgiIsMouseOverCanvas(canvas2) then process canvas2 input. Useful for multi-canvas tools where only one canvas should respond to mouse at a time. Can be called every frame without performance concerns. Does not indicate focus - use bgiGetFocusedCanvas for keyboard focus. Mouse can be over canvas without canvas having focus (user hasn't clicked it yet).