/********************\ | Copyright 2024, | | Ulysse Cura | \********************/ ///////////////////////////////////////////////////////////////////////// // // // Declaration de la classe TileMap, elle sert a charger tout ce // // qui est en rapport avec une map. (tileMap, entités, hitbox, etc...) // // // ///////////////////////////////////////////////////////////////////////// #ifndef MAP_HPP #define MAP_HPP #include #include #include #include #include "externLibs/nlohmann/json.hpp" #include "Vector2D.hpp" #define TILE_SIZE 16 #define TILEMAP_SCALE 2 using std::string, std::vector, std::unordered_map; using json = nlohmann::json; using TileID = int; struct NextMap { string path; Vector2D playerInitPos; }; class TileMap { public: TileMap() = default; ~TileMap(); void LoadEntities(json *); void LoadTileMap(const string &); void LoadNextMap(int); void LoadTileset(const string &); void draw(int); Vector2D getPlayerInitPos(); int tileMapWidth, tileMapHeight; int worldWidth, worldHeight; vector hitboxes; private: void m_draw(const vector &); vector m_tilesLayer1; vector m_tilesLayer2; vector m_tilesLayer3; int m_tilesetWidth, m_tilesetHeight; SDL_Texture *m_tileset; Vector2D m_playerInitPos; unordered_map m_nextMaps; }; #endif