代码拉取完成,页面将自动刷新
#pragma once
#include "Engine.h"
#include <map>
#include <string>
#include <unordered_map>
#include "GameUtil.h"
class Font
{
private:
Font();
std::string fontnamec_;
std::string fontnamee_;
int stat_message_ = 0;
int simplified_ = 1;
std::map<uint32_t, std::map<int, BP_Texture*>> buffer_; //缓存画过的字体
std::unordered_map<std::string, std::string> t2s_buffer_; //缓存繁体转简体的结果
public:
static Font* getInstance()
{
static Font f;
return &f;
}
static BP_Rect getBoxSize(int textLen, int size, int x, int y);
void setStatMessage(int s) { stat_message_ = s; }
void draw(const std::string& text, int size, int x, int y, BP_Color color = { 255, 255, 255, 255 }, uint8_t alpha = 255);
void drawWithBox(const std::string& text, int size, int x, int y, BP_Color color = { 255, 255, 255, 255 }, uint8_t alpha = 255, uint8_t alpha_box = 255);
void drawText(const std::string& fontname, std::string& text, int size, int x, int y, uint8_t alpha, int align, BP_Color c);
void clearBuffer();
int getBufferSize();
static int getTextDrawSize(const std::string& text);
void setSimplified(int s) { simplified_ = s; }
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。