0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 13:43:41 +00:00
SDL_Minigame/src/Map.cpp
2024-01-23 18:50:21 +01:00

24 lines
402 B
C++

#include "Map.h"
#include <fstream>
#include "Constants.h"
#include "Game.h"
void Map::loadMap(const char* path, int sizeX, int sizeY)
{
char tile;
std::fstream mapFile;
mapFile.open(path);
for (int y = 0; y < sizeY; y++)
{
for (int x = 0; x < sizeX; x++)
{
mapFile.get(tile);
Game::addTile(atoi(&tile), x * TILE_SIZE, y * TILE_SIZE);
mapFile.ignore();
}
}
mapFile.close();
}