ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
Toggle main menu visibility
载入中...
搜索中...
未找到
UITextBox.h
浏览该文件的文档.
1
#pragma once
2
#include "
../Core/Core.h
"
3
#include "
UITextInput.h
"
4
#include <string>
5
6
namespace
Shit
{
25
class
SHIT_API
SHIT_REFLECT
(BlackList)
UITextBox
:
public
UITextInput
{
26
SHIT_REFLECT_BODY
(
UITextBox
)
27
public
:
28
UITextBox
();
29
~UITextBox
()
override
=
default
;
30
31
void
setCharacterLimit
(
size_t
limit) { m_characterLimit = limit; }
32
size_t
getCharacterLimit
()
const
{
return
m_characterLimit; }
33
34
protected
:
35
void
onRender
(
const
SDL_FRect& screenRect)
override
;
36
void
insertText
(
const
std::string& utf8)
override
;
37
38
private
:
39
void
insertNewline()
override
;
// 单行:拒绝换行
40
SHIT_META
(({.displayName =
"Character Limit"
, .tooltip =
"最大字符数(0=不限)"
}))
41
size_t
m_characterLimit = 0;
// 0 = 不限
42
};
43
}
Core.h
SHIT_API
#define SHIT_API
定义
Core.h:14
SHIT_REFLECT_BODY
#define SHIT_REFLECT_BODY(Type)
定义
Macros.h:62
SHIT_REFLECT
#define SHIT_REFLECT(Mode)
定义
Macros.h:59
SHIT_META
#define SHIT_META(...)
定义
Macros.h:68
UITextInput.h
Shit::UITextBox::setCharacterLimit
void setCharacterLimit(size_t limit)
定义
UITextBox.h:31
Shit::UITextBox::UITextBox
UITextBox()
Shit::UITextBox::onRender
void onRender(const SDL_FRect &screenRect) override
子类实现:在给定屏幕矩形内绘制自身(通过 Renderer 静态 API 绘制)
Shit::UITextBox::insertText
void insertText(const std::string &utf8) override
子类可覆写:向缓冲插入一段 UTF-8 文本
Shit::UITextBox::getCharacterLimit
size_t getCharacterLimit() const
定义
UITextBox.h:32
Shit::UITextBox::~UITextBox
~UITextBox() override=default
Shit::UITextInput::UITextInput
UITextInput()=default
Shit
定义
AudioPlayer.h:10
include
ShitEngine
UI
UITextBox.h
制作者
1.17.0