Hi guys, i'm new to both SFML and c++. Im trying to make a dungeon crawler game, im having issues when i try to read from a file containing 1's and 0's (1 for a wall, 0 for blank square).
I'm reading the file into a 2D array and using this array to tell my array of sprites to draw the walls of the level.
Im using this code to read the file (I spent a while looking around these forums trying to get this to work so it may be wrong)
map.open("layout.txt");
while(map && y<80)
{
getline(map,line);
while(x<64)
{
Board[x][y]=line[x]-'0';
x++;
}
y++;
x=0;
}
That part seems to be working fine
To draw the sprites Im using the following
for(int i=0;i<64;++i)
{
for(int j=0;j<80;++j)
{
if(Board[i][j] == 1)
{
Map[i][j].SetImage (Wall);
Map[i][j].SetPosition (WallX,WallY);
WallX = WallX + 20;
}
WallY = WallY + 10;
}
}
When i run the program I get an error saying
Unhandled exception at 0x011b33d7 in Pacman.exe: 0xC00000FD: Stack overflow.
Then visual studio shows me pointing to the probe page line
; Find next lower page and probe
cs20:
sub eax, _PAGESIZE_ ; decrease by PAGESIZE
test dword ptr [eax],eax ; probe page.
jmp short cs10
I assume the error is in the way Im making my walls, is there a better way to do this?