Coding4Fun Blog

Windows Store DirectX C++ Sample

Description

Today's Project by Michael B. McLaughlin is one that's got the Channel 9 team excited, having been picked as a Pick of the Week on This Week on Channel 9 and emailed to me as a "Hey, Greg can you..." by another Niner too.

Last June (wow, has it been that long?) we covered the DirectX Toolkit, DirectXTK - the DirectX Tool Kit (which can be found here, http://directxtk.codeplex.com/). Today's project uses the DirectXTK and shows you how to take it into the Windows App Store world...

Windows Store DirectX C++ Sample Base

I’ve been working on this on and off for over a year now (having essentially restarted entirely in the latter half of 2012). At last it is finished. I give you a Windows Store DirectX C++ Sample Base. It’s something you could build a game on top of. It’s something you could build a sample on top of. It passes WACK testing (or did until I reverted to the default icons anyway) and runs properly on my Surface RT as well as my other x64-based computers. It handles rotation. Lets you choose a fixed back buffer size. Includes an audio engine class, a Texture2D class, and a RenderTarget2D class. Makes use of DirectXTK. Lets you do fancy things like mixing XAML and DirectX while still using multisampling. Has a custom settings pane with premade volume controls, a privacy settings pane (you need to supply the appropriate privacy policy and any other controls you need, if any), and even an about settings pane. Shows you the basics of using XInput. Shows you the basics of doing async in C++ using the ConcRT PPL Tasks library. And it even includes Shawn Hargreaves’ cat and a Cornflower Blue background!

...The code is all very commented. Key things you’ll want to look at are App.xaml.cpp, DirectXPage.xaml.cpp, DirectXPage.xaml, and Game.cpp (which derives from DirectXBase, which you may also want to look at). Note that the descriptions of what functions do are all in the header (.H) files whereas the comments on how they do it tend to all be in the CPP files.

...You can grab the sample here: BaseWin8Direct3DApp.zip [GD: Click through to the original post and get the download link there... I didn't want to leach his traffic....]. You need to be running Windows 8 and Visual Studio Express 2012 for Windows 8 or Visual Studio 2012 Professional or above. I hope to start creating samples using this as a base to build on very soon. I’d be thrilled if others did the same. I’ll also try to include some posts about developing for the Windows Store in general (helpful links, good blogs, etc.) and about using C++.

...

Not really up to speed on C++? Michael and SyncFusion have got your back with the free [Reg-ware] ebook, C++ Succinctly.

The code sample downloaded, compiled and ran for me the first time. It's a simple sample, but that's it's intent, a simple sample to get you up and running in the DirectX Windows 8 world...

screenshot_02032013_112417

Also Blog Standards requires all blogs to post at least one cat thing a year, so now we're good for 2013... Tongue Out

Anyway...

Here's a snap of Solution;

imageimage

As you can see, there's more here than meets the eye, putting more in place than you see in the sample app, helping you do much more than show a cat (not that there's anything wrong with that... Smiley

If you want to get started with DirectX in a Windows Store App, this sample looks like a great place to start...

The Discussion

  • tomkirbygre​en

    If I didn't know better I'd begin to think that the spiritual successor to WinForms, Silverlight and WPF was C++, C++ CX, native XAML and DirectX! A situation which frankly rocks and bodes very well for future improved device form factors. More please! Smiley

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.