Tilemap Node
Tilemap Migration
As an in-world entity, the Tilemap must become a Node to inherit its Draw method. The tilemap's transform will now handle world translation, and the map will be drawn at the tilemap's transform.
// --- Add: Includes. ---
#include "app.h"
#include "node.h"
// --- End ---
namespace ng {
/// @brief Represents a grid-based map composed of tiles from a Tileset.
class Tilemap : public Node { // Add: Inherit from Node.
Tilemap(App* app, sf::Vector2u size, Tileset tileset); // Change: Add App parameter.
// -----
protected:
/// @brief Renders the tilemap.
/// @param target The SFML RenderTarget to draw to.
void Draw(sf::RenderTarget& target) override; // Change: Instead of having a public Draw, override the node's method.
// -----
};
} // namespace ngLast updated