Vous êtes sur la page 1sur 15

C++ Programming for Game Developers

Module I

(10 Week Lesson Plan)

1
Lesson 1: Introducing C++

Textbook: Chapter One

Goals:

• Create, compile, link and execute C++ programs.


• Find out how C++ code is transformed into machine code.
• Learn some of the basic C++ features necessary for every C++ program.
• Discover how to output and input text information to and from the user.
• Understand the concept of variables.
• Perform simple arithmetic operations in C++.

Key Topics:

• Our First C++ Program


o Creating the Project
o Adding .CPP File to the Project
o Writing the Code
o Compiling, Linking, and Executing
o Comments
o White Space
o Include Directives
o Namespaces
o The main{...} Function
o std::string
o cin and cout

• Variables
o Declarations and Definitions
o Names
o sizeof
o The unsigned Keyword
o Literal Assignments
o Type Conversions / Casts
o typedefs
o Const Variables
o Macros

• Arithmetic Operations
o Unary Arithmetic Operations
o The Modulus Operator
o Compound Arithmetic Operations
o Operator Precedence

2
Projects:

Exercise 1.1: Arithmetic Operators


Exercise 1.2: Cin/Cout
Exercise 1.3: Cube
Exercise 1.4: Area/Circumference
Exercise 1.5: Average
Exercise 1.6: Bug Fixing

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 1; 2% of


final grade.

Recommended Study Time (hours): 6 - 8

3
Lesson 2: Conditionals, Loops, and Arrays

Textbook: Chapter Two

Goals:

• Understand and evaluate logical expressions.


• Form and apply conditional, if…then, statements.
• Discover how to execute a block of code repeatedly using various kinds of loops
• Learn how to create containers of variables and how to manipulate the individual
elements in those containers.

Key Topics:

• The Relational Operators


• The Logical Operators
• Conditional Statements
o The If Statement
o The Else Clause
o Nested If…Else Statements
o The Switch Statement
o The Ternary Operator
• Repetition
o The for-loop
o The while Loop
o The do…while Loop
o Nesting Loops
o Break and Continue Keywords
• Arrays
o Array Initialization
o Iterating Over an Array
o Multidimensional Arrays

Projects:

Exercise 2.1: Logical Operator Evaluation


Exercise 2.2: Navigator
Exercise 2.3: Average
Exercise 2.4: Factorial
Exercise 2.5: Matrix Addition
Exercise 2.6: ASCII
Exercise 2.7: Linear Search
Exercise 2.8: Selection Sort

4
Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 2; 2% of
final grade.

Recommended Study Time (hours): 7 - 9

5
Lesson 3: Functions

Textbook: Chapter Three

Goals:

• Understand and construct logical code groupings/tasks as functions


• Understand the various definitions for scope as it pertains to variable declarations
• Understand how to use code libraries for common tasks in mathematics and for random
number generation
• Understand function parameter overloading and the concept of the default parameter

Key Topics:

• User-Defined Functions
o Functions with One Parameter
o Functions with Several Parameters
• Variable Scope
• Math Library Functions
• Random Number Library Functions
• Function Overloading
• Default Parameters

Projects:

Exercise 3.1: Factorial


Exercise 3.2: ToUpper/ToLower
Exercise 3.3: 3D Distance
Exercise 3.4: Arc Tangent 2
Exercise 3.5: Calculator Program
Exercise 3.6: Slot Machine
Exercise 3.7: Binary Search
Exercise 3.8: Bubble Sort

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 3; 2% of


final grade.

Recommended Study Time (hours): 6 – 8

6
Lesson 4: References and Pointers

Textbook: Chapter Four

Goals:

• Become familiar with reference and pointer syntax.


• Understand how C++ passes array arguments into functions.
• Discover how to return multiple return values from a function.
• Learn how to create and destroy memory at runtime (i.e., while the program is running).

Key Topics:

• References
o Constant References
• Pointers
o Computer Memory Primer
o Pointer Initialization
o Dereferencing
• Arrays Revisited
o Arrays and Pointers
o Pointer Arithmetic
o Arrays as Function Parameters
• Multiple Function Return Values using References and Pointers
• Dynamic Memory
o Allocating Memory
o Deleting Memory
o Memory Leaks
• std::vector
• Pointers to Functions

Projects:

Exercise 4.1: Dice Function


Exercise 4.2: Array Fill
Exercise 4.3: Quadratic Equation

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 4; 2% of


final grade.

Recommended Study Time (hours): 10 – 12

7
Mid-Term Examination

The midterm examination in this course will consist of 25 multiple-choice and true/false
questions pulled from the first four textbook chapters. Students are encouraged to use the
lecture presentation slides as a means for reviewing the key material prior to the examination.
The exam should take no more than 60 minutes to complete. It is worth 27% of student final
grade.

8
Lesson 5: Object Oriented Programming

Textbook: Chapter Five

Goals:

• Understand the problems object oriented programming attempts to solve.


• Define a class and instantiate members of that class.
• Learn some basic class design strategies.

Key Topics:

• Object Oriented Programming Ideas


• Classes and Objects
o Basic Syntax
o The Dot/Arrow Operators
o Header Files
ƒ Inclusion Guards
o Class Definitions
o Class Implementations
o Data Hiding: Private versus Public
o Constructors and Destructors
o Copy Constructors
o Assignment Operators

Projects:

Exercise 5.1: Gold


Exercise 5.2: Character Races
Exercise 5.3: Leveling Up
Exercise 5.4: Magic Points
Exercise 5.5: Random Encounters
Exercise 5.6: Weapon/Armor Store
Exercise 5.7: Magic Items
Exercise 5.8: Multiple Enemies

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 5; 2% of


final grade.

Recommended Study Time (hours): 10 – 12

9
Lesson 6: Strings and Miscellaneous C++ Topics

Textbook: Chapter Six

Goals:

• Understand how C++ natively describes strings.


• Learn some important standard library string functions.
• Review std::string and become familiar with some of its methods.
• Become familiar with the this pointer.
• Learn about the friend and static keywords.
• Discover how to create your own namespaces.
• Understand what enumerated types are, how they are defined in C++, and when they
would be used.

Key Topics:

• Char Strings
• String Literals
• Escape Characters
• C-String Functions
o Length (strlen)
o Equality (strcmp)
o Copying (strcpy)
o Addition (strcat)
o Formatting (sprintf)
• std::string
o Length
o Relational Operators
o Addition
o Empty Strings
o Substrings
ƒ Inserting
ƒ Finding
ƒ Replacing
o Bracket Operator
o getline
• The this Pointer
• Friends
o Friend Functions
o Friend Classes
• The static Keyword
o Static Variables in Functions
o Static Data Members

10
o Static Methods
• Namespaces
o Variations of the “using” Clause
• Enumerated Types

Projects:

Exercise 6.1: String Reverse


Exercise 6.2: To-Upper
Exercise 6.3: To-Lower
Exercise 6.4: Palindrome

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 6; 2% of


final grade.

Recommended Study Time (hours): 6 - 8

11
Lesson 7: Operator Overloading

Textbook: Chapter Seven

Goals:

• Learn how to overload the arithmetic operators.


• Discover how to overload the relational operators.
• Overload the conversion operators.
• Understand the difference between deep copies and shallow copies.
• Find out how to overload the assignment operator and copy constructor to perform deep
copies.

Key Topics:

• A Vector Class
o Constructors
o Equality
o Addition and Subtraction
o Scalar Multiplication
o Length
o Normalization
o The Dot Product
o Printing
o Accepting Input
• Overloading Arithmetic Operators
o Operator Overloading Syntax
o Overloading the Other Arithmetic Operators
• Overloading Relational Operators
• Overloading Conversion Operators
• Overloading the Extraction and Insertion Operators
• A String Class
o Assignment Operator
o Copy Constructor
o Bracket Operator
o Construction and Destruction

Projects:

Exercise 7.1: Fraction Class


Exercise 7.2: float Array Class

Exams/Quizzes: Quiz 7. Covers topics from Chapter 7; 2% of final grade.

Recommended Study Time (hours): 6 – 8

12
Lesson 8: File Input/Output

Textbook: Chapter Eight

Goals:

• Learn how to load and save text files


• Learn how to load and save binary files

Key Topics:

• Streams
• Text File I/O
o Saving Data
o Loading Data
• Binary File I/O
o Saving Data
o Loading Data

Projects:

Exercise 8.1: Line Count


Exercise 8.2: Rewrite

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 8; 2% of


final grade.

Recommended Study Time (hours): 6 - 8

13
Lesson 9: Inheritance and Polymorphism

Textbook: Chapter Nine

Goals:

• Understand what inheritance means in C++ and why it is a useful code construct.
• Understand the syntax of polymorphism, how it works, and why it is useful.
• Learn how to create general abstract types and interfaces.

Key Topics:

• Inheritance
o Repeated Inheritance
o “isa” vs. “hasa” relationships
o Base Class/Derived Class Casting
o Public vs. Private Inheritance
o Method Overriding
• Constructors and Destructors with Inheritance
• Multiple Inheritance
• Polymorphism
• How Virtual Functions Work
• The Cost of Virtual Functions
• Abstract Classes
o Interfaces

Projects:

Exercise 9.1: Employee Database

Exams/Quizzes: 10 Question (multiple choice) quiz. Covers topics from Chapter 9; 2% of


final grade.

Recommended Study Time (hours): 10 – 12

14
Lesson 10: Exam Preparation and Course Review

Textbook: NONE

Goals:

In this final lesson we will leave the student free to prepare for and take their final
examination. Multiple office hours will be held for student questions and answers.

Key Topics:

Projects: NONE

Exams/Quizzes: NONE

Recommended Study Time (hours): 12 - 15

Final Examination

The final examination in this course will consist of 75 multiple-choice and true/false questions
pulled from all of the textbook chapters covered to date. Students are encouraged to use the
lecture presentation slides as a means for reviewing the key material prior to the examination.
The exam should take no more than 120 minutes to complete. It is worth 55% of student final
grade.

15

Vous aimerez peut-être aussi