MouseButton

From OxeyeWiki

Revision as of 15:13, 29 January 2010 by Jeb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

mouseButton(x, y, button, clickCount)

This hook is called when-ever the user clicks on a mouse button or scrolls the mouse wheel.

Parameter Type Description
x An integer The on-screen x coordinate of the mouse click.
y An integer The on-screen y coordinate of the mouse click.
button An integer Which button that was pressed. Button 0 is LEFT, 1 is RIGHT, 2 is MIDDLE, 3 is WHEEL UP and 4 is WHEEL DOWN
clickCount An integer This value is usually 1, but if the user clicks the same button rapidly at the same location (within 10 pixels of the previous click), then this value will increase for each click. You can use this to detect double-clicking.
Daisymoon Video Lib

Example

  local function onMouseButton(x, y, button, clickCount)

    print(x .. ", " .. y .. ", " .. button .. ", " .. clickCount)

    if button == 0 then
    elseif button == 1 then
    elseif button == 2 then
    end

  end

  hook.add("mouseButton", onMouseButton)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox