Prepare your development environment for DirectX Windows Store apps

27 out of 41 rated this helpful - Rate this topic

Although not required for game or graphics app development with DirectX 11.1, Visual Studio 2012 makes development easier and more effective if you are new to the 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. Here we step you quickly through the process of creating a new Windows Store app with Microsoft DirectX in Visual Studio 2012.

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 2012.
  • 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 2012 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 2012.
  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 Direct3D 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 2012.

    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
BasicTimer.hProvides a high frequency timer for computing "ticks" for graphics and game update loops.
CubeRenderer.h/.cppCode that demonstrates how to create a spinning cube using Direct3D. This file is provided as a reference.
Direct3DBase.h/.cpp Creates the graphics device interface as well as any window size dependent resources. It also provides a method to present the current complete buffer in the swap chain.
DirectXHelper.h/.cppProvides support for PPL task-based asynchronous binary file reads.
<your project name>.h/.cppThe initial code page of your app. 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.
<your project name>Renderer.h/.cppProvides some default rendering behaviors for your Direct3D app to help you get started.
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.1 and DirectXMath APIs.
SimplePixelShader.hlslA simple pixel shader implementation in HLSL. Update or replace this file with your own pixel shader implementation.
SimpleVertexShader.hlslA simple vertex shader implementation in HLSL. Update or replace this file with your own vertex shader implementation.

 

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.
  • BasicTimer.cpp—a high-resolution timer that you can use in games and real-time graphics processing apps.
  • BasicTimer.cpp—a high-resolution timer that you can use for measuring "ticks" in a game loop.
  • FPSCounter.cpp—a Direct2D frames-per-second counter overlay.
  • 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.

 

 

Build date: 3/11/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.