跳到主要内容

PlayerTextDrawTextSize

描述

设置玩家文本绘图的尺寸(当启用PlayerTextDrawUseBox时的方框尺寸,或用于PlayerTextDrawSetSelectable的可点击区域)

参数名说明
playerid要设置尺寸的玩家 ID
PlayerText:textid要设置尺寸的玩家文本绘图的 ID
Float:widthX 轴尺寸(左右方向),遵循与 TextDrawCreate 相同的 640x480 网格坐标系
Float:heightY 轴尺寸(上下方向),遵循与 TextDrawCreate 相同的 640x480 网格坐标系

返回值

该函数不返回特定值。

示例

new PlayerText:welcomeText[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my server!");
PlayerTextDrawTextSize(playerid, welcomeText[playerid], 2.0, 3.6); // 设置尺寸为2.0x3.6

PlayerTextDrawShow(playerid, welcomeText[playerid]);
return 1;
}

注意事项

提示

坐标含义根据对齐方式变化:

  • 对齐方式 1(左对齐): width/height 表示方框右边界绝对坐标
  • 对齐方式 2(居中): 需交换 width/height 参数,width 表示方框总宽度
  • 对齐方式 3(右对齐): width/height 表示方框左边界起始坐标

特殊字体处理:

  • 使用字体类型 4(精灵图)和 5(模型预览)时,width/height 参数将转换为宽高偏移量

坐标系原点:

  • 方框坐标系原点位于 TextDrawCreate 坐标点向下 10.0 单位、向右 5.0 单位的位置

交互区域定义:

相关函数