Game Development Reference
In-Depth Information
Chapter 1. Getting
Started
with
Direct3D
They say the first steps are the hardest, and beginning a new game is no exception.
Therefore, we should use as much help as possible to make those first steps easier,
and get into the fun parts of game development. To support the new WinRT platform,
we need some new templates, and there are plenty to be had in Visual Studio 2012.
Most important to us is the Direct3D App template, which provides the base code for
a C++ Windows Store application, without any of the XAML that the other templates
include.
The template that we've chosen will provide us with the code to create a WinRT win-
dow, as well as the code for the Direct3D components that will allow us to create the
game world. This chapter will focus on explaining the code included so that you un-
derstand how it all works, as well as the changes needed to prepare the project for
our own code.
In this chapter we will cover the following topics:
• Creating the application window
• Initialising Direct3D
• Direct3D devices and contexts
• Render targets and depth buffers
• The graphics pipeline
• What a game loop looks like
• Clearing and presenting the screen
Setting up the stage
Let's begin by starting up Visual Studio 2012 (the Express Edition is fine) and creating
a new Direct3D App project. You can find this project in the same window by navigat-
ing to New Project | Templates | Visual C++ | Windows Store . Once Visual Studio
has finished creating the project, we need to delete the following files:
CubeRenderer.h
CubeRenderer.cpp
Search WWH ::




Custom Search