Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Bruce Sutherland
Learn C++ for Game Development
Cover
Title
Copyright
Contents at a Glance
Contents
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Beginning C++
Compilers
Programming Paradigms
Procedural Programming
Object-Oriented Programming
Generic Programming
C++ Game Programming
Our First C++ Program
Summary
Part 1: Procedural Programming
Chapter 2: Writing a Guessing Game with C++ Types
Dynamic Versus Static Typed Languages
Declaring Variables
Defining Variables
Integers
Unsigned Integers
Two’s Complement
Floating Point Numbers
Boolean Values
Enums
Switching from One Type to Another
static_cast
A Simple Guessing Game
Summary
Chapter 3: Creating Calculators with Operators
The Assignment Operator
Arithmetic Operators
The Addition Operator
The Subtraction Operator
The Multiplication and Division Operators
The Modulo Operator
A Simple Arithmetic Calculator
Relational Operators
Equality Operators
Greater-Than Operators
Less-Than Operators
Simple Comparison Calculators
Bitwise Operators
Hexadecimal Number Representation
The Binary & (AND) Operator
The Binary | (OR) Operator
The Binary ^ (Exclusive OR) Operator
The Left Shift (<<) Operator
The Right Shift (>>) Operator
Logical Operators
The && Operator
The || Operator
Unary Operators
Arithmetic Unary Operators
The Logical Not Unary Operator
The One’s Complement Operator
Summary
Chapter 4: Beginning C++ Game Development with Arrays
The C++ Array
Pointers
Pointer Arithmetic
Dereferencing Pointers
Pointers and Arrays
C Style Strings in Arrays
Working with C Style Strings
Text Adventure Game
Summary
Chapter 5: Functions, the Building Blocks of C++
Writing Our First Function
Passing Parameters to Functions
Return Values
Passing by Pointer
Passing by Reference
Structures
Adding Functions to Text Adventure
Summary
Chapter 6: Making Decisions with Flow Control
The if Statement
The else and else if Statements
The for Loop
The while Loop
The switch Statement
The break and continue Keywords
The goto Statement
Adding a Game Loop to Text Adventure
Summary
Chapter 7: Organizing Projects Using Files and Namespaces
Source and Header Files
Creating Namespaces
Updating Text Adventure with Source Files, Header Files, and Namespaces
Summary
Part 2: Object-Oriented Programming
Chapter 8: Object-Oriented Programming with Classes
Object-Oriented Programming
Encapsulation
Constructors and Destructors
Method Overloading
Operator Overloading
Updating Text Adventure to Use Classes
Summary
Chapter 9: Controlling Data with Access Modifiers
The static Keyword
Creating static Local Variables
Using static class Member Variables
Using static Member Methods
Using static to Alter Global Scope
The const Keyword
Constant Variables
Constant Pointers
Constant Parameters
Constant Member Methods
Two More Keywords
The inline Keyword
The friend Keyword
Summary
Chapter 10: Building Games with Inheritance
Inheriting from a Base Class
Constructors and Destructors in Derived Classes
Method Overriding
Updating Text Adventure
Creating an Entity Class
Adding Inheritance to the Player Class
Adding Rooms
Moving Through Rooms
Summary
Chapter 11: Designing Game Code with Polymorphism
Virtual Methods
Downcasting and Upcasting with dynamic_cast
Creating Interfaces with Pure Virtual Methods
Using Polymorphism in Text Adventure
Summary
Chapter 12: Copying and Assigning Data to Objects
Copy Constructors
Assignment Operators
Move Semantics
Summary
Part 3: The STL
Chapter 13: The STL String Class
Standard string and basic_string
Constructing Strings
Working with Strings
Accessing String Data Through Iterators
Searching Within Strings
Formatting Data with stringstream
Summary
Chapter 14: STL Array and Vector
The STL Array Template
The STL Vector Class
Sorting Arrays and Vectors
Summary
Chapter 15: STL List
Understanding Array and List Memory Layouts
Building a List Class
The STL List Template
Summary
Chapter 16: STL’s Associative Containers
The STL set Container
The STL map Container
Binary Search Trees
Fast Data Access Using a Hash Map
STL unordered_set and unordered_map
Summary
Chapter 17: STL’s Stack and Queue
The STL stack Container
The STL queue Container
Summary
Chapter 18: STL’s bitset
Creating bitset Objects
Working with bitsets
Summary
Chapter 19: Using the STL in Text Adventure
Using STL array to Store Room Pointers
Using a vector and a map to Store Options
Adding Gameplay to Text Adventure
Summary
Part 4: Generic Programming
Chapter 20: Template Programming
Compile Versus Runtime Time Compilation
const Versus constexpr
assert Versus static_assert
Summary
Chapter 21: Practical Template Programming
Creating Singleton Classes with Templates
Implementing the EventManager Class
The EventHandler Interface
The Event Class
The EventManager Implementation
Calculating SDBM Hash Values Using a Template Metaprogram
Using an Event to Quit the Game
Summary
Part 5: C++ Game Programming
Chapter 22: Managing Memory for Game Developers
Static Memory
The C++ Stack Memory Model
Working with Heap Memory
Writing a Basic Single Threaded Memory Allocator
Summary
Chapter 23: Useful Design Patterns for Game Development
Using the Factory Pattern in Games
Decoupling with the Observer Pattern
Easily Adding New Functionality with the Visitor Pattern
Summary
Chapter 24: Using File IO to Save and Load Games
What Is Serialization?
The Serialization Manager
Saving and Loading Text Adventure
Summary
Chapter 25: Speeding Up Games with Concurrent Programming
Running Text Adventure in Its Own Thread
Sharing Data Between Threads Using Mutexes
Using Futures and Promises
Summary
Chapter 26: Supporting Multiple Platforms in C++
Ensuring Types Are the Same Size on Multiple Platforms
Using the Preprocessor to Determine Target Platform
Summary
Chapter 27: Wrapping Up
An Overview of Text Adventure
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Title
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset