Pergunta

I have created a project that runs on Windows Phone 8 that uses the template Direct3D With XAML provided by the Windows Phone SDK. I have also incorporated DirectXTK and declared a std::unique_ptr<DirectX::SpriteBatch> m_SB; in the CubeRenderer.h

When I try to assign it in the function CreateDeviceResources thus:

m_SB.reset(new SpriteBatch(m_d3dContext.Get()));

it gives the error: An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module.

I do not know why this is. This works perfectly if I create the project with the Direct3D (Native) template.

Any help would be appreciated.

Foi útil?

Solução

You have to put the code inside the CreateWindowSizeDependentResources function, then it should work fine.

Source

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top