mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 13:43:41 +00:00
24 lines
402 B
C++
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();
|
|
}
|