locked
Mixing WinRT and DirectX

    Question

  • I have a Silverlight game that I plan to port to Metro. Although Silverlight generally ports well to WinRT, I was disappointed to learn WinRT is missing some the critical graphics capabilities needed by my game's game pieces. I now see that I need to rewrite the game using C++ and DirectX. C++ is fine, but I have no experience with DirectX, so I'm looking at a bit of a learning curve. Before I dive in I need to get a handle on the size of the effort I'm facing.

    My Silverlight game involves potentially hundreds of programmatically generated games pieces on a Canvas background with shader lighting effects applied to each piece. Each game piece is a Canvas subclass. Is it possible to simply change the game piece class so it incapsulates a DirectX surface? If so, that would be a huge help because I can then save most of my game code (i.e., most of the game's code does not care how the game pieces get rendered internally). OTOH, if the entire game window needs to be a DirectX surface, and if that surface can not contain WinRT objects (such as Canvas game pieces), then I'm looking at a much larger effort since it would be difficult to reuse much of my existing code.

    What say ye, o DirectX masters?
    Sunday, December 18, 2011 7:13 PM

Answers

  • Mixing Windows.UI.Xaml and DirectX is not supported in the Developer Preview.

    That said, if I'm understanding the way your pieces work they probably don't have a lot of dependencies on actual Canvas behavior so you may be able to write a light DX object to replace the Canvas pieces.

    --Rob

    • Marked as answer by BobF77 Tuesday, December 20, 2011 11:13 PM
    Monday, December 19, 2011 11:05 PM
    Moderator

All replies

  • Mixing Windows.UI.Xaml and DirectX is not supported in the Developer Preview.

    That said, if I'm understanding the way your pieces work they probably don't have a lot of dependencies on actual Canvas behavior so you may be able to write a light DX object to replace the Canvas pieces.

    --Rob

    • Marked as answer by BobF77 Tuesday, December 20, 2011 11:13 PM
    Monday, December 19, 2011 11:05 PM
    Moderator
  • Mixing Windows.UI.Xaml and DirectX is not supported in the Developer Preview.

    Thanks for your response Rob!

    I thought C++ was merely prevented from using XAML markup to define a UI (as opposed to instantiating UI controls programmatically). But after seeing your response I looked at the Windows.UI.Xaml namespace and I now see that's where all the WinRT controls are defined. Yikes! Does that mean C++ has no access to predefined UI controls such as buttons, check boxes, etc? All controls must be coded and drawn from scratch using DirectX?

    Tuesday, December 20, 2011 4:37 PM
  • C++ apps can use Xaml instead of DirectX.  What the Developer Preview doesn't provide support for is mixing the two.  You can find of discussion on Xaml and C++ in the Building Metro style apps with C++ forum.

    --Rob

    Tuesday, December 20, 2011 7:12 PM
    Moderator
  • Ok, that's what I was afraid of. XAML is missing key functionality important to many game developers, even for 2D casual games. OTOH, DirectX appears to be overkill and overly complex for many 2D casual games. It would be nice if XAML had the full power of Silverlight, but I can understand the stuff that was left out (non-rectangular clipping, effects, custom shaders, VideoBrush, etc) may have been considered to be potentially too taxing for ARM tablets.

    Thanks again for your answer.
    Tuesday, December 20, 2011 11:13 PM