Game Engine Architecture

(Ben Green) #1
79

2.2.5.1. The Start-Up Project


A Visual Studio solution can contain more than one project. Some of these
projects build executables, while others build libraries or DLLs. It’s possible
to have more than one project that builds an executable in a single solution.
However, you cannot debug more than one program at a time. For this reason,
Visual Studio provides a sett ing known as the “Start-Up Project.” This is the
project that is considered “current” for the purposes of the debugger.
The start-up project is highlighted in bold in the Solution Explorer.
Hitt ing F5 to run your program in the debugger will run the .exe built by the
start-up project (if the start-up project builds an executable).


2.2.5.2. Break Points


Break points are the bread and butt er of code debugging. A break point in-
structs the program to stop at a particular line in your source code so that you
can inspect what’s going on.
In Visual Studio, select a line and hit F9 to toggle a break point. When you
run your program and the line of code containing the break point is about to
be executed, the debugger will stop the program. We say that the break point
has been “hit.” A litt le arrow will show you which line of code the CPU’s pro-
gram counter is currently on. This is shown in Figure 2.11.


2.2. Microsoft Visual Studio


Figure 2.11. Setting a break point in Visual Studio.


2.2.5.3. Stepping through Your Code


Once a break point has been hit, you can single-step your code by hitt ing the
F10 key. The yellow program-counter arrow moves to show you the lines as
they execute. Hitt ing F11 steps into a function call (i.e., the next line of code
you’ll see is the fi rst line of the called function), while F10 steps over that func-

Free download pdf