Building a generic Tile Map
For our project, we need something that will manage the map. In fact, the map is nothing but a big grid. The cells can be of any shape (square, hexagonal, and so on). The only restriction is that all the cells of a single map should have the same geometry.
Moreover, each cell can contain several objects, possibly of different types. For example, a cell can contain some background texture for the ground, a tree, and a bird. Because SFML doesn't use a z buffer with sprites (also called a depth buffer), we need to simulate it by hand. This is called the Painter's Algorithm. Its principle is very simple; draw everything but by depth order, starting with the most distant. It's how a tradition art painter would paint.
All this information brings us to the following structure:
A
Mapclass must be of a specific geometry and must contain any number of layers sorted by theirzbuffer.A
Layercontains only a specific type. It also has azbuffer and stores a list of content...