-
Book Overview & Buying
-
Table Of Contents
Beginning C++ Game Programming - Second Edition
By :
The way in which we describe the game objects in the level1.txt file needs to be precise because the BlueprintObjectParser class we will code after this class will be reading the text from the file and looking for matches. For example, the [START OBJECT] tag will trigger the start of a new object. If that tag is misspelled as, say, [START OBJECR], then the whole system falls apart and there will be all kinds of bugs, and even crashes when we run the game. To avoid this happening, we will define constant (programmatically unchangeable) string variables for all the tags we need to describe the game objects. We can use these string variables instead of typing something such as [START OBJECT] and have much less chance of making a mistake.
Create a new header file in the Header Files/FileIO filter called ObjectTags.h and add the following code:
#pragma once
#include <string>
using namespace std;
static class ObjectTags {
public:
...