locked
Loading several ID2D1Bitmaps in to some sort of collection

    Question

  • Hello again, I'm currently working on a Visual studio template for 2D game.

    I have a load method for .jpg an .png and I would like to store the resulting ComPtr<ID2D1Bitmap> in some sort of a list or collection.

    My c++/cx is not so good, so i tried this

    Platform::Collections::Map<Platform::String^, ID2D1Bitmap>^

    and this

    Platform::Collections::Map<Platform::String^, Microsoft::WRL::ComPtr<ID2D1Bitmap>>^

    Both of them give me an error.

    What's the standard procedure for loading several bitmaps and storing them in some sort of collection Key Value paired that allows me to get it later and

    call m_d2dContext->DrawBitmap((The colection here));

    Thank you.

    Wednesday, March 6, 2013 3:44 PM

Answers

  • I'd stick with standard C++ and use std::vector or std::map .

    The advantage to using the Platform collections is that they can cross the ABI boundary. If you don't need that then you are better off avoiding them.

    --Rob

    Friday, March 8, 2013 8:13 PM
    Owner

All replies

  • Unless you plan to pass this collection across a component boundary you should use standard C++ collections rather than C++/Cx collections.

    --Rob

    Wednesday, March 6, 2013 9:47 PM
    Owner
  • It was a gool call, i tried saving an good old fashoned c++ array ID2D1Bitmap* m_bitmapArray[100] and it worked, I assambled a method that returned de ID2D1Bitmap* I asked for and i all worked.

    The only thing is that I wanted to do something more reusable like a List or Vector, any suggestions on how to implement that Rob?

    Thanks a lot.

    Friday, March 8, 2013 11:55 AM
  • I'd stick with standard C++ and use std::vector or std::map .

    The advantage to using the Platform collections is that they can cross the ABI boundary. If you don't need that then you are better off avoiding them.

    --Rob

    Friday, March 8, 2013 8:13 PM
    Owner
  • thanks rob, I'll try it.
    Monday, March 11, 2013 10:46 AM