Hello, I am trying to make a tile map for the first time and it is not working. I am using SFML 2.0.
TileMap::LoadTileMap:
void TileMap::loadTileMap(std::string fileName, sf::Image img){
std::cout << "Creating a new tile map\n";
m_MapFile.open(fileName, std::ios::in);
if(!m_MapFile.is_open()) {
std::cout << "Could not find map file\n";
return;
}else{
std::cout << "Found the map file\n";
Tile tempTile;
sf::Texture tempTex;
int tileX = 0; //current tile placment
int tileY = 0; //current tile placement
int tileNumX; //current tiles placment in the row
int tileNumY; //current tiles row
//while not the end of the map, get a line and set
//tiles based on the map
while(!m_MapFile.eof()){
std::string line;
std::getline(m_MapFile, line);
for(int i = 0; i != line.size(); ++i){
//a space seperates the tile chords
if(line[i] == ' ') continue;
//a comma seperates the x and y chords
if(line[i] == ',') continue;
if(line[i + 1] == ',') tileNumX = (int)line[i];
if(line[i + 1] == ' ') tileNumY = (int)line[i];
//if the current char is the y chord then the tile chords are complete, add to the tile map vector
if(line[i + 1] == ' '){
tempTex.loadFromImage(img, sf::IntRect(tileNumX * m_TILESIZE_X,
tileNumY * m_TILESIZE_Y, m_TILESIZE_X,
m_TILESIZE_Y));
tempTile.setTile(sf::Vector2f((float)tileX, (float)tileY), tempTex);
m_Map.push_back(tempTile);
}
++tileX;
}
++tileY;
}
}
}
The error I get is in the command window and it repeats this for each tile:
Failed to create texture, its internal size is too high (4294965856x4294965840, maximum is 8192x8192)
thank you for any help.
EDIT: m_TILESIZE_X and m_TILESIZE_Y are static const unsigned int that are 32 ea;