public interface Mouse
Modifier and Type | Interface and Description |
---|---|
static class |
Mouse.CursorStyle
The style of the cloud cursor
|
static class |
Mouse.KeyType
General mouse button types
|
Modifier and Type | Method and Description |
---|---|
void |
onMouseDeltaMove(int deltaX,
int deltaY)
According to the offset pixel amount [localDeltaX, localDeltaY] of the local mouse movement,
calculate the relative movement pixel amount [DeltaX, DeltaY] of the remote movement.
|
void |
onMouseKey(Mouse.KeyType key,
boolean down)
Trigger a click event of the cloud mouse.
|
void |
onMouseMoveTo(int x,
int y)
After you get the coordinates of the local View, you need to convert the coordinates to the coordinates of the
remote end before calling this method.Before calculation, you need to get the width and height of the gameView
[localViewWidth, localViewHeight] and the position of the click position in the game screen [localX, localY].
|
void |
onMouseScroll(float delta)
Rotate the scroll wheel of the cloud mouse.
|
void |
setMouseCursorStyle(Mouse.CursorStyle cursorStyle)
Set the cursor style.
|
void setMouseCursorStyle(Mouse.CursorStyle cursorStyle)
Mouse.CursorStyle
will be updated immediately: the new cursor style will be distributed
from the cloud through the data channel. You can get the latest mouse style image from Observer.cursorStyle
- The new cursor style, which will overwrite the original style value.void onMouseKey(Mouse.KeyType key, boolean down)
key
- The mouse button. Valid values: `left`: The left button; `middle`: The scroll wheel; `right`:
The right button; `forward`: The forward side button; `backward`: The back side button.down
- Valid values: `true`: Press; `false`: Release.void onMouseScroll(float delta)
delta
- Valid values: -1.0~1.0void onMouseDeltaMove(int deltaX, int deltaY)
// localX/localY: click coordinates on gameView
// localViewWidth/localViewHeight: gameView width&height
DeltaX = localDeltaX * MouseConfig.getMoveSensitivity() * 8192 / localViewWidth;
DeltaY = localDeltaY * MouseConfig.getMoveSensitivity() * 8192 / localViewHeight;
// send mouse move message
onDeltaMove(DeltaX,DeltaY);
deltaX
- The offset on the horizontal axis by which the cursor needs to move in remote devicedeltaY
- The offset on the vertical axis by which the cursor needs to move in remote devicevoid onMouseMoveTo(int x, int y)
// localX/localY: click coordinates on gameView
// localViewWidth/localViewHeight: gameView width&height
remoteX = localX * 8192 / localViewWidth;
remoteY = localY * 8192 / localViewHeight;
// send mouse move message
onMoveTo(remoteX,remoteY);
x
- The X coordinate on the remote devicey
- The Y coordinate on the remote device