0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 09:03:42 +00:00
Benedikt Galbavy 9e346a719d Reimplemented collision
still missing documentation
2024-11-15 22:25:43 +01:00

41 lines
1.2 KiB
C++

#pragma once
#include <tmxlite/Property.hpp>
#include <optional>
#include <tmxlite/Types.hpp>
#include <map>
#include <string>
#include <vector>
class GameInternal;
class Map
{
public:
Map() = default;
~Map() = default;
/*!
*
* \brief
* This loads a map
*
* \param path The path to the map file
* \return Boolean for success
*
*/
[[deprecated("ID based text files are not supported anymore, use .txm maps instead")]]
static void loadMap(const char* path, int sizeX, int sizeY, GameInternal* game, const std::map<int, std::pair<std::string, bool>>* textureDict /* backreference */);
[[deprecated]]
static void addTile(unsigned long id, int x, int y, GameInternal* game, const std::map<int, std::pair<std::string, bool>>* textureDict);
/*!
* \brief Loads a .tmx map
* \param path Path to the `.tmx` map file
*
*/
static void loadMapTmx(const char* path);
private:
static void addTile(float x, float y, const tmx::Vector2u& mapTileSize, int u, int v, int zIndex, const char* texturePath, bool hasCollision);
template<typename T>
static std::optional<T> getLayerProperty(const std::vector<tmx::Property>& properties, std::string propertyName) { return std::nullopt; };
};