TcrSdk-Windows V1.0
Public Types | Public Member Functions | List of all members
Mouse Class Referenceabstract

This interface is used to interact with the virtual Mouse device on the server. More...

#include <mouse.h>

Public Types

enum class  MouseKeyType {
  LEFT , RIGHT , MIDDLE , FORWARD ,
  BACKWARD
}
 General mouse button types. More...
 
enum class  CursorStyle { NORMAL , HUGE }
 The style of the cloud cursor. More...
 

Public Member Functions

virtual void SetMouseCursorStyle (const CursorStyle &cursor_style) const =0
 Set the cursor style.
 
virtual void OnMouseKey (const MouseKeyType &key, bool down) const =0
 Trigger a click event of the cloud mouse.
 
virtual void OnMouseScroll (float delta) const =0
 Rotate the scroll wheel of the cloud mouse.
 
virtual void OnMouseMoveTo (int32_t x, int32_t y) const =0
 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].
 

Detailed Description

This interface is used to interact with the virtual Mouse device on the server.

Member Enumeration Documentation

◆ CursorStyle

enum class CursorStyle
strong

The style of the cloud cursor.

Enumerator
NORMAL 

The default cursor style.

HUGE 

The big cursor style.

◆ MouseKeyType

enum class MouseKeyType
strong

General mouse button types.

Enumerator
LEFT 

The left mouse button.

RIGHT 

The right mouse button.

MIDDLE 

The middle mouse button (scroll wheel)

FORWARD 

The forward side button.

BACKWARD 

The back side button.

Member Function Documentation

◆ OnMouseKey()

virtual void OnMouseKey ( const MouseKeyType key,
bool  down 
) const
pure virtual

Trigger a click event of the cloud mouse.

Parameters
keyThe 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.
downValid values: true: Press; false: Release.

◆ OnMouseMoveTo()

virtual void OnMouseMoveTo ( int32_t  x,
int32_t  y 
) const
pure virtual

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. You can refer to the sample code below to complete your own calculations.

 // 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);
Parameters
xThe X coordinate on the remote device
yThe Y coordinate on the remote device

◆ OnMouseScroll()

virtual void OnMouseScroll ( float  delta) const
pure virtual

Rotate the scroll wheel of the cloud mouse.

Parameters
deltaValid values: -1.0~1.0

◆ SetMouseCursorStyle()

virtual void SetMouseCursorStyle ( const CursorStyle cursor_style) const
pure virtual

Set the cursor style.

The cursor style {

See also
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.
Parameters
cursorStyleThe new cursor style, which will overwrite the original style value.

The documentation for this class was generated from the following file: