
SFML Game Development
By :

A texture atlas describes the concept of a single texture that contains multiple objects. You may also encounter other terms, such as sprite sheet, or tile set in the case of squared tiles put together. Texture atlases allow having fewer image files, which decreases the amount of switches between different textures at runtime. Since texture switching is a rather slow operation on the graphics card, using texture atlases may result in notable speedups. Till now, we used separate textures for each object: one for each aircraft, pick-up, projectile, button, and background. Every texture was stored in its own PNG file. The code design looked as follows:
Textures were stored inside TextureHolder
, our container storing sf::Texture
objects.
We had an enum Textures::ID
to identify the different textures in a TextureHolder
. By that, we could easily refer to different textures without knowing the actual sf::Texture
object or the filename.
The textures used in the scene were...
Change the font size
Change margin width
Change background colour