Weird Runtime Exception at loading font?
Baseult opened this issue · comments
Hey so I followed the tutorial on how to draw Text in DX11 using DXTK but somehow everytime I initialize the font my game immediately crashes with a Runtime Error.
So I found this:
I have placed the "myfile.spritefon" file inside my "D:\MyProject\MyProject" folder, which includes the "MyProject.vcxproj" and other project files. I've also added the spritefont as an existing file to the project and set the "Content" to true.
The code I'm using to load the font is basically the default code:
m_font = std::make_unique<SpriteFont>(pDevice, L"myfile.spritefont");
The working Directory in my Debugging Settings is the Default "$(ProjectDir)" so that shouldn't be an issue?
The paths should also not change, as there isn't any other call for that.
So I've set a breakpoint and this is what it looks like:
It somehow is not able to read memory for the _MyVal2 value in std::default_deleteDirectX::SpriteFont::Impl which means it is not able to find the spritefont? That doesn't make any sense for me as the Spritefont is located inside the right folder?
So what am I doing wrong here?
you're injecting code that uses a relative path, into an exe with a different path
You need to define correct file path at runtime
spriteFont = std::make_unique<DirectX::SpriteFont>(g_graphicsEngine->GetD3DDevice(), L"C:/dir/path/myfile.spritefont");