Skip to content

取轴信息

获取当前光标位置和鼠标滚轮的值。

语法

cpp
class Device {
    Status getAxes(
        int16_t& x,
        int16_t& y,
        int16_t& w
    );
};
class Device {
    Status getAxes(
        int16_t& x,
        int16_t& y,
        int16_t& w
    );
};
e
类名基类公开备注
RX784设备
方法名返回值类型公开备注
取轴信息整数型
参数名类型参考可空数组备注
x短整数型
y短整数型
w短整数型
.版本 2 .程序集 RX784设备, , 公开 .子程序 取轴信息, 整数型, 公开 .参数 x, 短整数型, 参考 .参数 y, 短整数型, 参考 .参数 w, 短整数型, 参考
py
class Device:
    def get_axes(self) -> Tuple[Status, int, int, int]: ...
class Device:
    def get_axes(self) -> Tuple[Status, int, int, int]: ...

返回值

名称英文说明
状态码status成功返回
xx水平坐标,向右为正,取值范围是 0 <= x < 屏幕宽度
yy竖直坐标,向下为正,取值范围是 0 <= y < 屏幕高度
ww滚轮值,向前为正。

备注

使用前必须先 初始化绝对坐标系统。滚轮值可能溢出,需要妥善处理。

此操作相当于同时使用了 取位置取滚轮值,因只需与设备进行一次通讯,效率更高。

示例

cpp
#include <iostream>
#include "rx784.hpp"

int main() {
    RX784::Device device;
    int16_t x, y, w;

    device.open("COM1");

    device.initAbsSystem(1920, 1080);
    device.getAxes(x, y, w);
    std::cout << x << " " << y << " " << w << std::endl;
    // 相当于
    //   device.getPos(x, y);
    //   device.getWheelAxis(w);
    device.close();
}
#include <iostream>
#include "rx784.hpp"

int main() {
    RX784::Device device;
    int16_t x, y, w;

    device.open("COM1");

    device.initAbsSystem(1920, 1080);
    device.getAxes(x, y, w);
    std::cout << x << " " << y << " " << w << std::endl;
    // 相当于
    //   device.getPos(x, y);
    //   device.getWheelAxis(w);
    device.close();
}
e
方法名返回值类型公开备注
_启动子程序整数型
变量名类型静态数组备注
设备RX784设备
x短整数型
y短整数型
w短整数型
设备.打开 (“COM1”)
设备.初始化绝对坐标系统 (1920, 1080)
设备.取轴信息 (x, y, w)
调试输出 (x, y, w)
' 相当于
' 设备.取位置 (x, y)
' 设备.取滚轮值 (w)
设备.关闭 ()
返回 (0)
.版本 2 .子程序 _启动子程序, 整数型 .局部变量 设备, RX784设备 .局部变量 x, 短整数型 .局部变量 y, 短整数型 .局部变量 w, 短整数型 设备.打开 (“COM1”) 设备.初始化绝对坐标系统 (1920, 1080) 设备.取轴信息 (x, y, w) 调试输出 (x, y, w) ' 相当于 ' 设备.取位置 (x, y) ' 设备.取滚轮值 (w) 设备.关闭 () 返回 (0)
py
import rx784

device = rx784.Device()

device.open('COM1')

device.init_abs_system(1920, 1080)
status, x, y, w = device.get_axes()
print(x, y, w)
# 相当于
#   status, x, y = device.get_pos()
#   status, w = device.get_wheel_axis()

device.close()
import rx784

device = rx784.Device()

device.open('COM1')

device.init_abs_system(1920, 1080)
status, x, y, w = device.get_axes()
print(x, y, w)
# 相当于
#   status, x, y = device.get_pos()
#   status, w = device.get_wheel_axis()

device.close()