Displaying a grid based map using C++ and sdl

Posted by user15386 on Game Development See other posts from Game Development or by user15386
Published on 2012-04-15T20:25:03Z Indexed on 2012/04/16 5:48 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

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?

© Game Development or respective owner

Related posts about c++

Related posts about sdl