Learning C++ by Building Games with Unreal Engine 4: a Beginner's Guide to Learning 3D Game Development with C++ and UE4, 2nd Edition [2nd ed] 9781788476249, 9781788398701, 9781788991445, 1788476247, 9781788479219, 1788479211

Learn the fundamentals of C++ programming with a fun-filled, practical guide and create your own games using Unreal Engi

3,852 1,220 64MB

English Pages 456 Year 2018

Report DMCA / Copyright

DOWNLOAD FILE

Learning C++ by Building Games with Unreal Engine 4: a Beginner's Guide to Learning 3D Game Development with C++ and UE4, 2nd Edition [2nd ed]
 9781788476249, 9781788398701, 9781788991445, 1788476247, 9781788479219, 1788479211

Table of contents :
Cover
Title Page
Copyright and Credits
www.PacktPub.com
Contributors
Table of Contents
Preface
Chapter 1: Getting Started with C++17
Setting up our project
Using Microsoft Visual Studio on Windows
Downloading and Installing Visual Studio
Starting a New Project in Visual Studio
Using Xcode on a Mac
Downloading and installing Xcode
Starting a new project in Xcode
Creating your first C++ program
Semicolons
Handling errors
Warnings in C++
What is building and compiling?
Example output
Exercise --
ASCII art
Summary
Chapter 2: Variables and Memory
Variables Declaring variables --
touching the siliconReading and writing to your reserved spot in memory
Numbers and math
Numbers are everything
More on variables
Math in C++
Exercises
Generalized variable syntax
Primitive types
Advanced variable topics
Automatically detecting type
Enums
const variables
Building more complex types
Object types --
struct
Exercise --
player
Solution
Pointers
What can pointers do?
Address of operator (&)
Using nullptr
Smart pointers
Input and output
The cin and cout objects
The printf() function
Exercise
Solution
Namespaces
Summary Chapter 3: If, Else, and SwitchBranching
Controlling the flow of your program
The == operator
Coding if statements
Coding else statements
Testing for inequalities using other comparison operators (>
,>
=, <
, <
=, and!=)
Using logical operators
The not (!) operator
Exercises
Solutions
The and (& &) operator
The or (||) operator
Exercise
Solution
Branching code in more than two ways
The else if statement
Exercise
Solution
The switch statement
The switch statement versus the if statement
Exercise
Solution
Bit-shifted enums
Our first example with Unreal Engine
Summary Chapter 4: LoopingThe while loop
Infinite loops
Exercises
Solutions
The do/while loop
The for loop
Exercises
Solutions
Looping with Unreal Engine
Summary
Chapter 5: Functions and Macros
Functions
An example of a library function --
sqrt()
Writing our own functions
A sample program trace
Exercise
Solution
Functions with arguments
Functions that return values
Exercises
Solutions
Initializer lists
Variables revisited
Global variables
Local variables
The scope of a variable
Static local variables
Const variables
Const and functions
Function prototypes .H and .cpp filesprototypes.h
funcs.cpp
main.cpp
extern variables
Macros
Macros with arguments
Constexpr
Summary
Chapter 6: Objects, Classes, and Inheritance
What is an object?
The struct object
Member functions
The this keyword
Are strings objects?
Invoking a member function
Exercises
Solutions
Privates and encapsulation
Some people like it public
The class keyword versus struct
Getters and setters
Getters
Setters
But what's the point of get/set operations?
Constructors and destructors
Class inheritance
Derived classes
Syntax of inheritance

Polecaj historie