-
Book Overview & Buying
-
Table Of Contents
SFML Blueprints
By :
Before starting to build randomly and without any specific planning, we need to have some information: what kind of game you want to build (RPG, FPS, or action-adventure), what elements will be used, and so on. The aim of this chapter is to understand the general game structure, which can be used in any kind of game. Through this part, we will study:
In the previous chapter, we have seen the minimal code required for a game, which contains:
Instead of having one function do all the work, we will make use of object-oriented practices and define various states in different functions. Moreover, we will encapsulate the methods in a new class named Game, and we will minimize the main function. This Game class will be the starting point for all our future games:
class Game
{
...
Change the font size
Change margin width
Change background colour