#ifndef MAP_H #define MAP_H #include #include "raylib.h" #include "entities/TextureWrapper.h" #include /** * Holds the collision and texture maps for the game world */ class Map { public: Map(); ~Map() {} void draw(); /** Checks and returns which corners of the object have been collided with */ std::unordered_map checkForCollision(TextureWrapper texture); int getTileSize() { return this->tileSize; } std::vector> getColMap() { return this->colMap; } private: /** Holds the number for every single tile, which refers to a certain sprite in the tileset */ std::vector> map; /** Holds 1s (collision) and 0s (no collision) for every tile */ std::vector> colMap; unsigned int tileSize = 32; Texture2D tileset; void loadMap(); void loadColMap(); void loadTileset(); /** * Converts the corners of the object to the matching tiles, so that they can be checked for collision */ std::unordered_map cornersToTilePos(std::unordered_map corners); }; #endif