Skip to main content
Create a new DirectX Windows Store app

Here you'll see how to create a new Windows Store app with Microsoft DirectX in Visual Studio 2013.

Although it's not required for game or graphics app development with DirectX 11.2, Visual Studio 2013 makes development easier and more effective if you are new to the Windows 8 platform. It provides templates for many kinds of Windows Store apps, including DirectX apps (like games), and has a fully-integrated, basic debugging and app deployment environment.

Creating a new Windows Store Direct3D project

In this section, you learn:

  • How to create a new project for Windows Store Direct3D apps in Visual Studio 2013
  • How to simplify your initial game or graphics app development by using sample code provided by Microsoft

To get started, create a new Direct3D app project using the C++ language. Currently, only native C++ is supported for Direct3D apps. Visual Studio 2013 includes a template for DirectX Windows Store apps that gives you a head start in developing for Direct3D. The template provides the basic view provider infrastructure and window support, and references to all the necessary headers and components.

BR229582.wedge(en-us,WIN.10).gifTo create a new Windows Store Direct3D app project

  1. Install Visual Studio 2013.
  2. Select File > New Project. The New Project dialog box opens.
  3. In the Installed > Templates pane, select Visual C++.
  4. In the center pane, select DirectX App.
  5. Type a name for the project. In this example, you'll name the project MyDirectXApp.

    There's a new project created in Visual Studio 2013.

    New Project Wizard for Direct3D

  6. Click OK. Your project files are created.
  7. To run the app, select Debug > Start Debugging, or press F5. At this point, you'll see a blank window that fills the entire screen.

When you create your project, Visual Studio creates the project files and displays them in the Solution Explorer pane.

File layout for Direct3D App

Let's look at the files that the blank app creates.

File nameFile description
Common\DirectXHelper.h/.cppProvides support for PPL task-based asynchronous binary file reads. Additionally, it checks to see if the Debug layers are available.
Common\StepTimer.hProvides a high frequency timer for computing "ticks" for graphics and game update loops.
Content\Sample3DSceneRenderer.h/.cppAn implementation of a basic renderer for a simple spinning 3D cube scene. This code provides the execution of the DirectX graphics pipeline, and is a good place to start when adding additional graphics features.
Content\SampleFpsTextRenderer.h/.cpp Draws an overlay that displays the number of frames presented per second as a Direct2D overlay. Use this for testing, or to better understand Direct2D for developing heads-up displays and overlays.
Content\SamplePixelShader.hlslA simple pixel shader implementation in HLSL. Update or replace this file with your own pixel shader implementation.
Content\SampleVertexShader.hlslA simple vertex shader implementation in HLSL. Update or replace this file with your own vertex shader implementation.
Content\ShaderStructures.hDefines the data structures that contain graphics data passed to the shaders, including the constant buffers.
App.h/.cppProvides the default DirectX view provider and resource configuration for your Direct3D app to help you get started. It provides a basic set of behaviors for common Windows Runtime events, including app suspend and resume. It also provides methods for initializing and updating the core window object that displays the rendered graphics from your Direct3D swap chain.
DeviceResources.h/.cppContains all the code for creating and configuring DirectX graphics resources, including Direct3D and Direct2D resources. This file provides a good baseline configuration that handles many common Direct3D scenarios, including screen rotation and device loss/disconnect events.
<your project name>Main.h/.cppCreates the renderer and timer object and runs the main app loop. Use this code as the starting point when creating additional app states and communicating between the renderer and the app framework.
Package.appxmanifestContains all the capabilities of your Windows Store app, as well all the metadata you must configure to successfully deploy and publish your app.
pch.h/.cppProvides references to the Direct3D 11.2 and DirectXMath APIs.

 

Optional preparation steps

If you don't use the provided template, we recommend you review How to set up your Windows Store C++ app to display a DirectX view to learn the basics of how to enable DirectX in your Windows Store C++ app.

Also, you can download sample code from the Direct3D Tutorial Sample that will greatly simplify basic 3D development. This sample provides code that supports many common DirectX behaviors used in game development and that you can include in your app. Here are the files included in the tutorial sample:

  • BasicCamera.cpp—a basic camera implementation.
  • BasicLoader.cpp—a file I/O manager for assets (such as textures).
  • BasicReaderWriter.cpp—an async asset loader that can help with performance by loading assets in the background.
  • LonLatController.cpp—a basic longitude/latitude controller class for navigation on a sphere, using mouse or touch input.

The classes and methods provided by this sample code will help you develop a stronger sense for using DirectX by learning some of the more basic setup and infrastructure tasks common to game development, letting you focus on understanding DirectX and the Windows Runtime as a whole.

Note  The code in the sample files listed here are provided "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

 

 

Send comments about this topic to Microsoft

Build date: 11/5/2013