Hello,
recently, -i don't know from when- BMFont crash right after launch.
I figure out why,
void CCharWin::DrawGlyphs(HDC dc, RECT &rc, TEXTMETRIC &tm)
{
int offset = 0, charEnd = 255;
if (fontGen->IsUsingUnicode())
{
const SSubset *subset = fontGen->GetUnicodeSubset(unicodeSubset);
offset = subset->charBegin; // <-- throw exception because subset is zero
charEnd = subset->charEnd;
}
...
}
subset should be -i guess- initialized in CCharwin::Create(width, height, configFile) before Draw();
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPrevInst,
LPSTR cmdLine,
int showFlag)
{
// Turn on memory leak detection
// Find the memory leak with _CrtSetBreakAlloc(n) where n is the number reported
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
_CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);
Init();
string configFile;
int result = 0;
bool openGui = processCmdLine(cmdLine, configFile, result);
if( openGui )
{
CCharWin *wnd = new CCharWin(512, 512, configFile);
wnd->Create();
....
}
...
}
LRESULT CCharWin::MsgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
...
switch( msg )
{
case WM_PAINT:
Draw();
return 0;
...
}
But, suddenly execute priority is changed.
It occur both in v1.13 and v1.14 beta.
When, If execute binary(bmfont.exe) in cmd(prompt), run correctly.
Please figure out.
Thanks.