Skip to content

坐标打包 - PackPoint

函数简介

(x, y) 打包为 int64,供 MousePosCallback 返回值使用。各语言绑定请调用本组 DLL 接口,保证与插件内部 bit 布局一致

接口名称

PackPoint

DLL调用

cpp
int64_t PackPoint(int32_t x, int32_t y);

打包格式

字段位域说明
x低 32 位有符号 int32
y高 32 位有符号 int32
无效值packed == -1OLA_POINT_INVALID,表示回调无法提供坐标

解包请使用 UnpackPointUnpackPointXUnpackPointY

参数说明

参数名类型说明
x整数型X 坐标。
y整数型Y 坐标。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long handle = ola.PackPoint(100, 200);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
long handle = ola.PackPoint(100, 200);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
handle = ola.PackPoint(100, 200)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
long handle = ola.PackPoint(100, 200);
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
handle := ola.PackPoint(100, 200)
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let handle = ola.pack_point(100, 200);
cpp
var ola = com("OlaPlug.OlaSoft")
var handle = ola.PackPoint(100, 200)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
handle = ola.PackPoint(100, 200)
text
.局部变量 ola, OLAPlug
ola.创建 ()
handle = ola.PackPoint(100, 200)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var handle = ola.PackPoint(100, 200);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 handle = ola.PackPoint(100, 200)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long handle = ola.PackPoint(100, 200);

原生 DLL 调用

cpp
int64_t packed = PackPoint(100, 200);
csharp
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long PackPoint(int x, int y);

long packed = PackPoint(100, 200);
python
from ctypes import CDLL, c_int32, c_int64, CFUNCTYPE

ola = CDLL("OLAPlug_x64.dll")
ola.PackPoint.argtypes = [c_int32, c_int32]
ola.PackPoint.restype = c_int64

packed = ola.PackPoint(100, 200)

返回值

返回值说明
(返回值)打包后的 int64。

注意事项

项目说明
禁止使用 Windows LOWORD /禁止使用 Windows LOWORD / HIWORD / MAKELPARAM 解包,负坐标会错误;请使用本组解包接口。
本组接口 无 instance 参数本组接口 无 instance 参数,本地直接调用即可。