Displaying a grid based map using C++ and sdl
- by user15386
I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class.
Currently, my code is this:
for (int y = 0; y!=MAPHEIGHT; y++)
{
for (int x = 0; x!=MAPWIDTH 1; x++)
{
apply_surface( x * TILEWIDTH, y * TILEHEIGHT, mymap[x][y].image, screen );
}
}
However, running this code causes it to both dither for a while before opening the SDL window, and (usually) tell me there is an access violation.
How can I display my map?