官术网_书友最值得收藏!

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 proper architecture
  • The importance of proper time management in applications
  • Using sf::Clock and sf::Time classes
  • Fixed and variable time-steps
主站蜘蛛池模板: 石狮市| 聂拉木县| 罗定市| 郓城县| 偃师市| 奉贤区| 梨树县| 盖州市| 花莲市| 革吉县| 那坡县| 舒兰市| 陇西县| 安多县| 吉首市| 韶关市| 平阴县| 二连浩特市| 丹凤县| 柘城县| 小金县| 蛟河市| 滦南县| 微山县| 卓资县| 边坝县| 宣武区| 南陵县| 西丰县| 铁岭市| 绵阳市| 昭苏县| 乌什县| 白河县| 惠水县| 石楼县| 广东省| 大英县| 广平县| 嘉义县| 岳阳县|