Mouse Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | Mouse.h |
– onMouseKey:isDown:
required method
Trigger a click event of the cloud mouse.
- (void)onMouseKey:(TCRMouseKeyType)key isDown:(BOOL)down
Parameters
key |
The mouse button. Valid values: |
---|---|
down |
Valid values: |
Discussion
Trigger a click event of the cloud mouse.
Declared In
Mouse.h
– onMouseScroll:
required method
Rotate the scroll wheel of the cloud mouse.
- (void)onMouseScroll:(float)delta
Parameters
delta |
Valid values: -1.0~1.0 |
---|
Discussion
Rotate the scroll wheel of the cloud mouse.
Declared In
Mouse.h
– onMouseDeltaMove:deltaY:
required method
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)onMouseDeltaMove:(int)deltaX deltaY:(int)deltaY
Parameters
deltaX |
The offset on the horizontal axis by which the cursor needs to move in remote device |
---|---|
deltaY |
The offset on the vertical axis by which the cursor needs to move in remote device |
Discussion
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.
Declared In
Mouse.h
– onMouseMoveTo:y:
required method
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].
Then calculate the coordinates through the following sample code to get [remoteX,remoteY].
Finally, call the interface to send the mouse movement event.
- (void)onMouseMoveTo:(int)x y:(int)y
Parameters
x |
The X coordinate on the remote device |
---|---|
y |
The Y coordinate on the remote device |
Discussion
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].
Then calculate the coordinates through the following sample code to get [remoteX,remoteY].
Finally, call the interface to send the mouse movement event.
Declared In
Mouse.h