Feature/render pipeline (#232)
* refactor(engine): 重构2D渲染管线坐标系统 * feat(engine): 完善2D渲染管线和编辑器视口功能 * feat(editor): 实现Viewport变换工具系统 * feat(editor): 优化Inspector渲染性能并修复Gizmo变换工具显示 * feat(editor): 实现Run on Device移动预览功能 * feat(editor): 添加组件属性控制和依赖关系系统 * feat(editor): 实现动画预览功能和优化SpriteAnimator编辑器 * feat(editor): 修复SpriteAnimator动画预览功能并迁移CI到pnpm * feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm * feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm * feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm * feat(editor): 修复SpriteAnimator动画预览并迁移到pnpm * feat(ci): 迁移项目到pnpm并修复CI构建问题 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 迁移CI工作流到pnpm并添加WASM构建支持 * chore: 移除 network 相关包 * chore: 移除 network 相关包
This commit is contained in:
46
packages/components/src/TextComponent.ts
Normal file
46
packages/components/src/TextComponent.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Component, ECSComponent, Serializable, Serialize } from '@esengine/ecs-framework';
|
||||
|
||||
/**
|
||||
* 文本对齐方式
|
||||
*/
|
||||
export enum TextAlignment {
|
||||
Left = 'left',
|
||||
Center = 'center',
|
||||
Right = 'right'
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本组件 - 管理文本渲染
|
||||
*/
|
||||
@ECSComponent('Text')
|
||||
@Serializable({ version: 1, typeId: 'Text' })
|
||||
export class TextComponent extends Component {
|
||||
/** 文本内容 */
|
||||
@Serialize() public text: string = '';
|
||||
|
||||
/** 字体 */
|
||||
@Serialize() public font: string = 'Arial';
|
||||
|
||||
/** 字体大小 */
|
||||
@Serialize() public fontSize: number = 16;
|
||||
|
||||
/** 颜色 */
|
||||
@Serialize() public color: string = '#ffffff';
|
||||
|
||||
/** 对齐方式 */
|
||||
@Serialize() public alignment: TextAlignment = TextAlignment.Left;
|
||||
|
||||
/** 行高 */
|
||||
@Serialize() public lineHeight: number = 1.2;
|
||||
|
||||
/** 是否加粗 */
|
||||
@Serialize() public bold: boolean = false;
|
||||
|
||||
/** 是否斜体 */
|
||||
@Serialize() public italic: boolean = false;
|
||||
|
||||
constructor(text: string = '') {
|
||||
super();
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user