Summary
First, we looked at exactly what the new game is and how it will be played. Then, we made the project in the usual way and coded the shortest main function (main game loop) of the entire book!
Next, we began coding the new way we will handle the player’s input by delegating specific responsibilities to individual game entities/objects and having them listen for messages from a new InputDispatcher class.
We coded a class called Factory that will be responsible for “knowing” how to assemble all the different components we will build into usable derived types before being placed/composed inside GameObject instances.
We learned about C++ inheritance, polymorphism, and C++ smart pointers for passing responsibility for memory management to the compiler.
Then, we coded the key GameObject class. The Component class, which is the parent class for almost every other class, we will code in the rest of the book and which the GameObject instances will...