Keeping track of resources
In general game development, the term resource defines an external component that will be loaded at runtime within the application. Most of the time, a resource is a multimedia file such as music and image, but it can also be a script or a configuration file. Throughout this book, the term resource will mostly refer to a multimedia resource.
The resources require more memory, and one of the consequences of this is that all the operations on it run slowly, such as the copy. Another thing is that we don't want to have the same resource loaded multiple times in the memory. To avoid all this, we will use them in a particular way, with the help of a resource manager. Most of the time, a resource is loaded from a file to the hard disk, but there are other ways to load them, for example, from the memory or the network.
Resources in SFML
The SFML library deals with a great numbers of different resources:
Graphics module |
Audio module |
---|---|
Texture |
SoundBuffer |
Image |
Music... |