- Documentation
- Client functions
- getBrowserPositionFromScreen
Function
getBrowserPositionFromScreen
Turns a screen point (e.g. the cursor) into a pixel of a browser page drawn in the world with dxDrawMaterialLine3D or dxDrawMaterialPrimitive3D. This lets you click on screens and billboards with a browser standing in the world.
Syntax
int, int getBrowserPositionFromScreen(browser material, float screenX, float screenY)Arguments
materialbrowser- The browser (material) drawn in the world.
screenXfloat- Screen X.
screenYfloat- Screen Y.
Returns
The page pixel (x, y) or false.
Example
addEventHandler("onClientRender", root, function()
local ax, ay = getCursorPositionAbsolute()
if not ax then return end
local px, py = getBrowserPositionFromScreen(billboard, ax, ay)
if px then injectBrowserMouseMove(billboard, px, py) end
end)
Notes
One function. You do not have to work out yourself which pixel the cursor hits; this function does it.
See also
injectBrowserMouseMoveMoves the mouse cursor on the page.injectBrowserMouseDownPresses a mouse button on the page at the position of the lastinjectBrowserMouseMove. Two presses at the same spot within 0.5 s reach the page as a double click, three as a triple click (paragraph selection), like in Windows.dxDrawMaterialLine3DDraws a material (an image, a texture, a browser, a camera or a shader) as a strip in the 3D world: from the start point (top of the image) to the end, with a given width. The strip faces the camera or thefaceX, faceY, faceZpoint. The drawing is part of the world: buildings hide it and it glows (a screen is visible at night). This is how you make a billboard, a cinema screen or a sign above a building.