Files

31 lines
584 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <SDL2/SDL_ttf.h>
#include "EngineFrame/Component/Sprite.h"
class Text : public Sprite
{
public:
Text(/* args */);
~Text();
// 显式引入基类的Init方法避免隐藏
using Actor::Init;
void Init(std::string Str, TTF_Font *font, SDL_Color color);
void Render() override;
public:
/** 文本内容 */
std::string m_text;
/** 字体 */
TTF_Font *m_font;
/** 字体颜色 */
SDL_Color m_color;
public:
// 设置文本
void SetText(std::string Str);
// 获取文本
std::string GetText();
};