いつもお世話になっております。
質問なのですが、以下のページを参考にUTF-8を使用した文字列描画を試したところ、
バグと思われる挙動を確認しました。
ttp://dxlib.o.oo7.jp/lecture/Android/Android_CharCode.html
1. DrawStringToHandle系の関数では正常に描画されるが、DrawString系では文字化けを起こす
2. フルスクリーンモード時にAlt+Tabなどでウィンドウの切り替えを行い、再度戻ると文字化けを起こす
上記の挙動は仕様でしょうか?
動作環境はWindows 10 Ver.1703 x64
コンパイラはVisual Studio Community 2017です
以下コードです
#include "DxLib.h"
#include <string>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
ChangeWindowMode(FALSE);
SetUseCharCodeFormat(DX_CHARCODEFORMAT_UTF8);
DxLib_Init();
SetDrawScreen(DX_SCREEN_BACK);
std::string str = u8"ABC %d あいう";
int Font = CreateFontToHandle(NULL, -1, -1);
while (ProcessMessage() == 0 && ClearDrawScreen() == 0) {
// 文字化け
DrawString(0, 0, str.c_str(), GetColor(0xFF, 0xFF, 0xFF));
DrawFormatString(0, 20, GetColor(0xFF, 0xFF, 0xFF), str.c_str(), 10 + 20);
// 正常
DrawStringToHandle(0, 40, str.c_str(), GetColor(0xFF, 0xFF, 0xFF), Font);
DrawFormatStringToHandle(0, 60, GetColor(0xFF, 0xFF, 0xFF), Font, str.c_str(), 10 + 20);
ScreenFlip();
}
DxLib_End();
return 0;
}