Skip to content

绘制文本 - DrawGuiText

函数简介

创建文本绘制对象,支持字体、字号与对齐方式设置。

接口名称

DrawGuiText

DLL调用

int64_t DrawGuiText(int64_t instance, char* text, int32_t x, int32_t y, char* fontPath, int32_t fontSize, int32_t align);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
text字符串文本内容。
x整数型左上角X。
y整数型左上角Y。
fontPath字符串字体路径(ttf/otf)。
fontSize整数型字号(像素)。
align整数型0 左对齐,1 居中对齐,2 右对齐。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
long handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
long handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0);
cpp
var ola = com("OlaPlug.OlaSoft")
var handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0)
text
.局部变量 ola, OLAPlug
ola.创建 ()
handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long handle = ola.DrawGuiText("value", 100, 200, "C:\\test.txt", 0, 0);

原生 DLL 调用

cpp
DrawGuiText(instance, "value", 100, 200, "C:\\test.txt", 0, 0);
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int DrawGuiText(long ola, string text, int x, int y, string fontPath, int fontSize, int align);

DrawGuiText(instance, "value", 100, 200, "C:\\test.txt", 0, 0);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.DrawGuiText(instance, "value", 100, 200, "C:\\test.txt", 0, 0)

返回值

返回值说明
(返回值)对象句柄,失败返回 0。