[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-26 (世界標準時間)。"],[],[],null,["Use the following functions to add mouse device support to your game using the\nGame Controller library. We use the term mouse devices here to describe\ntraditional mice, as well as trackpads or trackballs.\n\nAdd a mouse status callback\n\nThe Game Controller library uses a mouse status callback to notify a game when a\nmouse is connected or disconnected. It supports only one mouse status callback\nat a time.\n\n- To register a mouse status callback or replace any previously registered callback with a new callback function, call the [`Paddleboat_setMouseStatusCallback`](/reference/games/game-controller/group/paddleboat#paddleboat_setmousestatuscallback) function.\n- To remove any currently registered callback, pass `NULL` or `nullptr` in the `statusCallback` parameter.\n- The `userData` parameter is an optional pointer to user defined data. The `userData` parameter will be passed to the callback function. This pointer is retained internally until changed by another call to `Paddleboat_setMouseStatusCallback`.\n\n void Paddleboat_setMouseStatusCallback(Paddleboat_MouseStatusCallback\n statusCallback, void *userData)\n\nThe function signature of the mouse status callback function is: \n\n typedef void (*Paddleboat_MouseStatusCallback)(const Paddleboat_MouseStatus\n mouseStatus, void *userData)\n\nThe `mouseStatus` enum parameter has three possible values:\n\n- `PADDLEBOAT_MOUSE_NONE`: No mouse device is currently connected.\n- `PADDLEBOAT_MOUSE_CONTROLLER_EMULATED`: A connected controller is simulating a mouse.\n- `PADDLEBOAT_MOUSE_PHYSICAL`: One or more physical mouse devices are connected. (These devices include a mouse, touchpad, trackball, or other similar devices.)\n\nThe `userData` parameter contains the `userData` pointer specified in the last\ncall to `Paddleboat_setMouseStatusCallback`. `userData` may be NULL or\n`nullptr`.\n\nNot all controllers simulate a mouse. Controllers may simulate a mouse using one\nof the analog sticks or with an integrated touchpad.\n\nThe Game Controller library only reports data from a singular mouse device.\nPhysical mouse devices take priority over virtual controller mouse devices. If a\nphysical mouse is connected, it takes over from any previously active virtual\ncontroller mouse.\n\nRead mouse data\n\nCall the [`Paddleboat_getMouseStatus`](/reference/games/game-controller/group/paddleboat#paddleboat_getmousestatus) function to get the status of the mouse device. \n\n Paddleboat_MouseStatus Paddleboat_getMouseStatus()\n\nUse the [`Paddleboat_getMouseData`](/reference/games/game-controller/group/paddleboat#paddleboat_getmousedata)\nfunction to get the current mouse data. This function returns\n`PADDLEBOAT_NO_ERROR` if data is successfully read, otherwise an\nappropriate error code is returned. \n\n bool Paddleboat_getMouseData(Paddleboat_Mouse_Data *mouseData)\n\nThe `Paddleboat_Mouse_Data` structure contains information about:\n\n- The most recent mouse input event timestamp\n- The current pointer position\n- Status of mouse buttons\n- Status of mouse wheels\n\n struct Paddleboat_Mouse_Data {\n uint64_t timestamp;\n uint32_t buttonsDown;\n int32_t mouseScrollDeltaH;\n int32_t mouseScrollDeltaV;\n float mouseX;\n float mouseY;\n }\n\n| Structure member | Description |\n|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `timestamp` | Timestamp of the most recent mouse input event. The timestamp value is in microseconds since. clock epoch. |\n| `buttonsDown` | Bitfield, each bit starting from bit 0 signifies a button down state if set. |\n| `mouseX` `mouseY` | Mouse position in pixel coordinates. Position coordinates have a range of `0.0` to the screen width and height. |\n| `mouseScrollDeltaH` `mouseScrollDeltaV` | A count of cumulative mouse scroll wheel events : since the previous call to `Paddleboat_getMouseData`. These values are not guaranteed to be precise, only to give an indication of scroll wheel activity in a particular direction. Most mice have a one scroll wheel, which is reported in `mouseScrollDeltaV`. If a mouse has a side scroll wheel, it is is reported in `mouseScrollDeltaH`. These values are reset to `0` internally after a call to `Paddleboat_getMouseData`. |\n\nThe Game Controller library defines bitmask constants for mouse buttons in the\n`paddleboat.h` interface header file: \n\n enum Paddleboat_Mouse_Buttons {\n PADDLEBOAT_MOUSE_BUTTON_LEFT = (1U \u003c\u003c 0),\n PADDLEBOAT_MOUSE_BUTTON_RIGHT = (1U \u003c\u003c 1),\n PADDLEBOAT_MOUSE_BUTTON_MIDDLE = (1U \u003c\u003c 2),\n PADDLEBOAT_MOUSE_BUTTON_BACK = (1U \u003c\u003c 3),\n PADDLEBOAT_MOUSE_BUTTON_FORWARD = (1U \u003c\u003c 4),\n PADDLEBOAT_MOUSE_BUTTON_6 = (1U \u003c\u003c 5),\n PADDLEBOAT_MOUSE_BUTTON_7 = (1U \u003c\u003c 6),\n PADDLEBOAT_MOUSE_BUTTON_8 = (1U \u003c\u003c 7)\n };\n\nPhysical versus virtual mouse devices\n\nA `Paddleboat_MouseStatus` of `PADDLEBOAT_MOUSE_CONTROLLER_EMULATED` indicates\nthat a physical mouse device is absent and the Game Controller library is\nsimulating a virtual mouse using a connected controller. The lowest connected\ncontroller index with the `PADDLEBOAT_CONTROLLER_FLAG_VIRTUAL_MOUSE` flag set is\nused as the virtual mouse. Virtual mouse devices are only guaranteed to report\n`mouseX` and `mouseY` coordinates. Virtual mouse devices may report presses from\na single (left) mouse button, but this is not guaranteed."]]