Game Development Reference
In-Depth Information
affecting other sections of the program. Inheritance and polymorphism are other important aspects
of the C++ OOP paradigm. OOP programming is the focus of Part 2 in this topic.
Generic Programming
Generic programming is most likely the least understood paradigm in C++ despite its widespread
use via the Standard Template Library. Templates allow programmers to write classes that can
operate on different types via specializations. Template metaprogramming is a powerful technique
that confers the ability to write programs within the code that generate values and code at compile
time. Templates and Metaprogramming are covered in Part 4 of this topic.
C++ Game Programming
C++ has been a major language of choice for game developers since its inception. All major gaming
platforms have supported and currently support C++ compilation. This includes Windows, Linux,
OS X, iOS, Xbox One, PlayStation 4, Wii U, and Android.
Part 5 of this topic covers advanced C++ topics that programmers will find useful as hardware
becomes more powerful. These include design patterns, streams, memory management,
concurrency (multithreaded programming), and a look at how we can write code that supports
multiple game development platforms.
Our First C++ Program
Let's take a look at a simple C++ program before we get started with the details of C++. Listing 1-1
shows a simple C++ program written in Microsoft Visual Studio Express 2012 for Windows Desktop.
Listing 1-1. Our First C++ Program
// Chapter1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "What is your name?" << endl;
string name {};
cin >> name;
cout << "You said your name is: " << name << endl;
return 0;
}
 
Search WWH ::




Custom Search