28 เมษายน 2555 22:53
This question has to do with the DirecXTK library that Chuck Walbourn & Shawn Hargreaves put together. I'm using c++, VS11 Ultimate beta, and win 8 CP to make a metro app.
The SpriteBatch takes a pointer to the deviceContext as an argument in the constructor:
explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext);
However, using the Direct3DApplication starter project, it creates the ID3D11deviceContext using a ComPtr:
So when I try the line from Shawn's Blog,:
std::unique_ptr<SpriteBatch> spriteBatch(new SpriteBatch(m_d3dContext));
I get a red squiggly under the 'left paren' between the words SpiteBatch & the m_d3dContext. The compile error says this:
cannot convert parameter 1 from 'Microsoft::WRL::ComPtr<T>' to 'ID3D11DeviceContext *'
I'm a little too new at c++ and pointers to know how to resolve this, but I bet there's an easy answer. How would I go about converting the pointers to give the SpriteBatch constructor what it wants?
- แก้ไขโดย Shazen 28 เมษายน 2555 22:53