Prepare your development environment for DirectX Windows Store apps
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.
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.
To create a new Windows Store Direct3D app project
- Install Visual Studio 2012.
- Select File > New Project. The New Project dialog box opens.
- In the Installed > Templates pane, select Visual C++.
- In the center pane, select Direct3D App.
- 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.
- Click OK. Your project files are created.
- 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.
Let's look at the files that the blank app creates.
|File name||File description|
|BasicTimer.h||Provides a high frequency timer for computing "ticks" for graphics and game update loops.|
|CubeRenderer.h/.cpp||Code 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/.cpp||Provides support for PPL task-based asynchronous binary file reads.|
|<your project name>.h/.cpp||The 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/.cpp||Provides some default rendering behaviors for your Direct3D app to help you get started.|
|Package.appxmanifest||Contains 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/.cpp||Provides references to the Direct3D 11.1 and DirectXMath APIs.|
|SimplePixelShader.hlsl||A simple pixel shader implementation in HLSL. Update or replace this file with your own pixel shader implementation.|
|SimpleVertexShader.hlsl||A simple vertex shader implementation in HLSL. Update or replace this file with your own vertex shader implementation.|
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/14/2013