修改文字的渲染逻辑

This commit is contained in:
Lenheart 2024-12-27 15:26:20 +08:00
parent 8812074f05
commit 5c84877220
2 changed files with 5 additions and 45 deletions

View File

@ -9,41 +9,6 @@ class TextActor extends CL_BaseObject {
//不需要Update函数
NoUpdate = true;
OutlineChild = null;
Strokeoffsets = [{
x = 1,
y = 0
}, // 右
{
x = 1,
y = 1
}, // 右上
{
x = 0,
y = 1
}, // 上
{
x = -1,
y = 1
}, // 左上
{
x = -1,
y = 0
}, // 左
{
x = -1,
y = -1
}, // 左下
{
x = 0,
y = -1
}, // 下
{
x = 1,
y = -1
} // 右下
];
/*
* @函数作用: 构造文本精灵
* @参数 font 可传入全局font Id 或 传入 font对象
@ -75,16 +40,11 @@ class TextActor extends CL_BaseObject {
//设置文本内容
function SetText(str) {
TextActor_SetText(this.C_Object, str);
if (OutlineChild) {
foreach(obj in OutlineChild) {
obj.SetText(str);
}
}
}
//设置描边
function SetOutline(width, color = Color.Black, cap = CapStyle.Square, line_join = LineJoinStyle.Round, dash = DashStyle.Solid) {
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
function SetOutline(color = Color.Black, flag = true) {
TextActor_SetOutLine(this.C_Object, color, flag);
}
// //设置描边

View File

@ -10,8 +10,8 @@ class _FontAssetManager_ {
//初始化字体
function InitFont() {
//普通宋体小字
Font.PreLoad("Fonts/GasinamuNew.ttf");
Font("gasinamuM", 11.5).Register(0);
Font.PreLoad("Fonts/Gasinamu.ttf");
Font("gasinamu", 11.5).Register(0);
}
constructor() {
@ -28,7 +28,7 @@ class _FontAssetManager_ {
local TextActor = TextActor(0, style);
TextActor.SetText(text);
if (stroke)
TextActor.SetOutline(3.0);
TextActor.SetOutline();
return TextActor;
}
}