Get started developing a simple DirectX game for the Windows Store
Creating a Microsoft DirectX game for the Windows Store is a challenge for a new developer. Here we quickly review the concepts involved and the steps you must take to begin developing a game using DirectX and C++.
Let's get started.
To develop a game in DirectX for the Windows Store, you must have a few basic skills. Specifically, you must be able to:
- Read and write modern C++ code (C++11 helps the most), and be familiar with basic C++ design principles and patterns like templates and the factory model. You must also be familiar with common C++ libraries like the Standard Template Library, and specifically with the casting operators, pointer types, and the various data-structure template types (such as std::vector).
- Understand basic geometry, trigonometry, and linear algebra. Much of the code you will find in the examples assumes you understand these forms of mathematics and their common rules.
- Have a passing familiarity with the Windows Runtime and its core APIs, especially those in Windows::UI::Core, Windows::ApplicationModel, and Microsoft::WRL—especially Microsoft::WRL::ComPtr (smart pointer).
- Understand the foundations of graphics and graphics technology, particularly 3D graphics. While DirectX itself has its own terminology, it still builds upon a well-established understanding of general 3D graphics principles.
Of course, you must have Windows 8.1 and a good understanding of its primary UI features, too! You'll encounter a lot of info that assumes some understanding of:
- Process Lifetime Management (PLM), which includes suspend and resume event handling and behaviors.
- Screen orientation, and the support for both portrait and landscape modes.
- Windows, also called "app views," which define the region of a screen owned by an app for drawing and updating.
- View providers, as discussed in How to set up your app to display a view.
As with other Windows Store apps, the journey of a thousand miles starts with Microsoft Visual Studio Express 2013 for Windows—specifically the edition for Windows Store apps, not the one for Microsoft Windows Desktop apps.
If you haven't already done so, then, download and install Visual Studio Express 2013 for Windows. It has all the tools you need to get started.
When you create a new C++ project in Microsoft Visual Studio (by going to FILE > New > Project or by pressing Ctrl+Shift+N), the dialog presents you with a number of choices. For our purposes here, choose DirectX app as your template.
Some of the guidance here also builds upon a separate template—the WDC DirectX game learning template—which we make available for download as a code sample here. This useful sample template builds on the foundation of the DirectX app template, adding support for simple sound playback, consolidated input state management, and support for multiple discrete 2D overlays.
Ready to start? Let's review before we head on. You have:
- An updated and working installation of Windows 8.1.
- An installation of Visual Studio Express 2013 for Windows.
- An intrepid spirit and a desire to learn more about DirectX game development!
|Use the Visual Studio 2013 DirectX templates||Take a tour of the DirectX app template and learn more about the basic graphics processing pipeline. These topics review the code in the template that is specific to graphics and graphics devices.|
|Use the WDC DirectX game learning template||Build on the DirectX app template with the WDC DirectX game learning template. Learn how to play sounds, incorporate multiple control models, and work with Direct2D for overlays and heads-up displays.|