C++编译后中文显示是??号

q916074607 q916074607 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
 void DrawT(int X, int Y, CColor Color, int Font, bool Center, char* _Input, ...)
{
char Buffer[1024] = { '\0' };

/* set up varargs*/
va_list Args;

va_start(Args, _Input);
vsprintf_s(Buffer, _Input, Args);
va_end(Args);

size_t Size = strlen(Buffer) + 1;

/* set up widebuffer*/
wchar_t* WideBuffer = new wchar_t[Size];

/* char -> wchar */
mbstowcs_s(nullptr, WideBuffer, Size, Buffer, Size - 1);

/* check center */
int Width = 0, Height = 0;

if (Center)
{
GetTextSize(Font, WideBuffer, Width, Height);
}

/* call and draw*/
DrawSetTextColor(Color._color[0], Color._color[1], Color._color[2], Color._color[3]);
DrawSetTextFont(Font);
DrawSetTextPos(X - (Width / 2), Y);
DrawPrintText(WideBuffer, wcslen(WideBuffer));

return;
}

void DrawString(int font, int x, int y, int align, CColor color, const wchar_t* text, ...)
{
DrawSetTextPos(x, y);
DrawSetTextColor(color._color[0], color._color[1], color._color[2], color._color[3]);
DrawSetTextFont(font);
DrawPrintText(text, wcslen(text));

return;
}


这个是代码
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
q916074607
C++ 语言 65,214 成员 250,514 内容