Chapter 2. Give It Some Structure – Building the Game Framework
Working on a project with poor structure is much like building a house with no foundation: it's difficult to maintain, extremely unstable, and will probably cause you to abandon it shortly. While the code we worked on in Chapter 1, It's Alive! It's Alive! – Setup and First Program, is functional and can be managed on a very small scale, expanding it without first building a solid framework would most likely result in tons of spaghetti code (not to be confused with ravioli code or lasagna code) being present. Although it sounds delicious, this pejorative term describes the pain of a new feature being exponentially more difficult to implement within the source code that is unstructured and executes in a "tangled" manner, which is something we'll be focusing on avoiding.
In this chapter we will cover:
- Designing a window class, along with a main game class
- Code restructuring and...